Captain Hook

ProcessWire master (3.0.62 and 2.8) Hooks Cheatsheet [info]

Hooks

Hooks can be set anywhere in modules or template code using a simple syntax. They can be either before or after a event/method happening in PW. There's also way to using addHook to add a new property or method to an existing template variable.

All methods in PW that have a ___ prefix can be hooked on either before or after.

Hook in Modules:

$this->addHookBefore('ClassName::method', $this, 'yourLocalMethod');
$this->addHookAfter('ClassName::method', $this, 'yourLocalMethod');

Hook in Templates:

$object->addHookBefore('method', null, 'yourLocalMethod');
$object->addHookAfter('method', null, 'yourLocalMethod');

Where $object can be either a template variable like $page, $pages, $fields, $templates etc. Or an instance of a module you load before with $modules->get("ModuleName");

HookEvent

Instances of HookEvent are passed to Hook handlers when their requested method has been called.

public function yourLocalMethod(HookEvent $event){
  $output = $event->return;
}

Useful Links

About this

This list is generated from the latest dev branch of ProcessWire master branch.

/wire/core/ AdminTheme.php

/wire/core/ AdminThemeFramework.php

/wire/core/ Config.php

/wire/core/ Field.php

/wire/core/ Fieldgroups.php

/wire/core/ Fields.php

/wire/core/ Fieldtype.php

/wire/core/ FieldtypeMulti.php

/wire/core/ FileCompiler.php

/wire/core/ FileCompilerModule.php

/wire/core/ FileValidatorModule.php

/wire/core/ ImageSizer.php

/wire/core/ Inputfield.php

/wire/core/ InputfieldWrapper.php

/wire/core/ ModuleJS.php

/wire/core/ ModulePlaceholder.php

/wire/core/ Modules.php

/wire/core/ NullPage.php

/wire/core/ Page.php

/wire/core/ PageArray.php

/wire/core/ PageExport.php

/wire/core/ Pagefile.php

/wire/core/ Pagefiles.php

/wire/core/ PagefilesManager.php

/wire/core/ PageFinder.php

/wire/core/ Pageimage.php

/wire/core/ Pages.php

/wire/core/ PagesType.php

/wire/core/ Password.php

/wire/core/ Permissions.php

/wire/core/ Process.php

/wire/core/ ProcessController.php

/wire/core/ ProcessWire.php

/wire/core/ Roles.php

/wire/core/ Sanitizer.php

/wire/core/ Session.php

/wire/core/ TemplateFile.php

/wire/core/ Templates.php

/wire/core/ Textformatter.php

/wire/core/ User.php

/wire/core/ Users.php

/wire/core/ Wire.php

/wire/core/ WireAction.php

/wire/core/ WireArray.php

/wire/core/ WireCache.php

/wire/core/ WireData.php

/wire/core/ WireDatabasePDO.php

/wire/core/ WireFileTools.php

/wire/core/ WireHttp.php

/wire/core/ WireLog.php

/wire/core/ WireMail.php

/wire/core/ WireMailInterface.php

/wire/core/ WireMailTools.php

/wire/core/ WireSaveableItems.php

/wire/core/ WireSaveableItemsLookup.php

/wire/modules/AdminTheme/AdminThemeDefault/ AdminThemeDefault.module

/wire/modules/AdminTheme/AdminThemeReno/ AdminThemeRenoHelpers.php

/wire/modules/Fieldtype/ FieldtypeCache.module

/wire/modules/Fieldtype/ FieldtypeCheckbox.module

/wire/modules/Fieldtype/FieldtypeComments/ CommentNotifications.php

/wire/modules/Fieldtype/FieldtypeComments/ FieldtypeComments.module

/wire/modules/Fieldtype/FieldtypeComments/ InputfieldCommentsAdmin.module

/wire/modules/Fieldtype/ FieldtypeDatetime.module

/wire/modules/Fieldtype/ FieldtypeFieldsetClose.module

/wire/modules/Fieldtype/ FieldtypeFieldsetOpen.module

/wire/modules/Fieldtype/ FieldtypeFieldsetTabOpen.module

/wire/modules/Fieldtype/ FieldtypeFile.module

/wire/modules/Fieldtype/ FieldtypeFloat.module

/wire/modules/Fieldtype/ FieldtypeImage.module

/wire/modules/Fieldtype/ FieldtypeInteger.module

/wire/modules/Fieldtype/ FieldtypeModule.module

/wire/modules/Fieldtype/FieldtypeOptions/ FieldtypeOptions.module

/wire/modules/Fieldtype/ FieldtypePage.module

/wire/modules/Fieldtype/ FieldtypePageTable.module

/wire/modules/Fieldtype/ FieldtypePageTitle.module

/wire/modules/Fieldtype/ FieldtypePassword.module

/wire/modules/Fieldtype/FieldtypeRepeater/ FieldtypeRepeater.module

/wire/modules/Fieldtype/FieldtypeRepeater/ InputfieldRepeater.module

/wire/modules/Fieldtype/ FieldtypeSelector.module

/wire/modules/Fieldtype/ FieldtypeText.module

/wire/modules/Fieldtype/ FieldtypeTextarea.module

/wire/modules/Fieldtype/ FieldtypeURL.module

/wire/modules/ ImageSizerEngineIMagick.module

/wire/modules/Inputfield/InputfieldAsmSelect/ InputfieldAsmSelect.module

/wire/modules/Inputfield/ InputfieldButton.module

/wire/modules/Inputfield/ InputfieldCheckbox.module

/wire/modules/Inputfield/InputfieldCheckboxes/ InputfieldCheckboxes.module

/wire/modules/Inputfield/InputfieldCKEditor/ InputfieldCKEditor.module

/wire/modules/Inputfield/InputfieldDatetime/ InputfieldDatetime.module

/wire/modules/Inputfield/ InputfieldEmail.module

/wire/modules/Inputfield/ InputfieldFieldset.module

/wire/modules/Inputfield/InputfieldFile/ InputfieldFile.module

/wire/modules/Inputfield/ InputfieldForm.module

/wire/modules/Inputfield/ InputfieldHidden.module

/wire/modules/Inputfield/InputfieldIcon/ InputfieldIcon.module

/wire/modules/Inputfield/InputfieldImage/ InputfieldImage.module

/wire/modules/Inputfield/ InputfieldInteger.module

/wire/modules/Inputfield/ InputfieldMarkup.module

/wire/modules/Inputfield/InputfieldPage/ InputfieldPage.module

/wire/modules/Inputfield/InputfieldPageAutocomplete/ InputfieldPageAutocomplete.module

/wire/modules/Inputfield/InputfieldPageListSelect/ InputfieldPageListSelect.module

/wire/modules/Inputfield/InputfieldPageListSelect/ InputfieldPageListSelectMultiple.module

/wire/modules/Inputfield/InputfieldPageName/ InputfieldPageName.module

/wire/modules/Inputfield/InputfieldPageTable/ InputfieldPageTable.module

/wire/modules/Inputfield/InputfieldPageTable/ InputfieldPageTableAjax.php

/wire/modules/Inputfield/InputfieldPassword/ InputfieldPassword.module

/wire/modules/Inputfield/InputfieldRadios/ InputfieldRadios.module

/wire/modules/Inputfield/ InputfieldSelect.module

/wire/modules/Inputfield/ InputfieldSelectMultiple.module

/wire/modules/Inputfield/InputfieldSelector/ InputfieldSelector.module

/wire/modules/Inputfield/InputfieldSubmit/ InputfieldSubmit.module

/wire/modules/Inputfield/ InputfieldText.module

/wire/modules/Inputfield/ InputfieldTextarea.module

/wire/modules/Inputfield/ InputfieldURL.module

/wire/modules/Jquery/JqueryCore/ JqueryCore.module

/wire/modules/Jquery/JqueryUI/ JqueryUI.module

/wire/modules/LanguageSupport/ FieldtypePageTitleLanguage.module

/wire/modules/LanguageSupport/ FieldtypeTextareaLanguage.module

/wire/modules/LanguageSupport/ FieldtypeTextLanguage.module

/wire/modules/LanguageSupport/ Languages.php

/wire/modules/LanguageSupport/ LanguagesPageFieldValue.php

/wire/modules/LanguageSupport/ LanguageSupport.module

/wire/modules/LanguageSupport/ LanguageSupportFields.module

/wire/modules/LanguageSupport/ LanguageSupportInstall.php

/wire/modules/LanguageSupport/ LanguageSupportPageNames.module

/wire/modules/LanguageSupport/ LanguageTranslator.php

/wire/modules/LanguageSupport/ ProcessLanguage.module

/wire/modules/LanguageSupport/ ProcessLanguageTranslator.module

/wire/modules/ LazyCron.module

/wire/modules/Markup/MarkupAdminDataTable/ MarkupAdminDataTable.module

/wire/modules/Markup/ MarkupCache.module

/wire/modules/Markup/MarkupHTMLPurifier/ MarkupHTMLPurifier.module

/wire/modules/Markup/ MarkupPageArray.module

/wire/modules/Markup/ MarkupPageFields.module

/wire/modules/Markup/MarkupPagerNav/ MarkupPagerNav.module

/wire/modules/Page/PageFrontEdit/ PageFrontEdit.module

/wire/modules/ PagePathHistory.module

/wire/modules/ PagePaths.module

/wire/modules/ PagePermissions.module

/wire/modules/ PageRender.module

/wire/modules/Process/ProcessCommentsManager/ ProcessCommentsManager.module

/wire/modules/Process/ProcessField/ ProcessField.module

/wire/modules/Process/ProcessField/ ProcessFieldExportImport.php

/wire/modules/Process/ ProcessForgotPassword.module

/wire/modules/Process/ ProcessHome.module

/wire/modules/Process/ ProcessList.module

/wire/modules/Process/ProcessLogger/ ProcessLogger.module

/wire/modules/Process/ProcessLogin/ ProcessLogin.module

/wire/modules/Process/ProcessModule/ ProcessModule.module

/wire/modules/Process/ProcessPageAdd/ ProcessPageAdd.module

/wire/modules/Process/ ProcessPageClone.module

/wire/modules/Process/ProcessPageEdit/ ProcessPageEdit.module

/wire/modules/Process/ProcessPageEditImageSelect/ ProcessPageEditImageSelect.module

/wire/modules/Process/ProcessPageEditLink/ ProcessPageEditLink.module

/wire/modules/Process/ProcessPageList/ ProcessPageList.module

/wire/modules/Process/ProcessPageList/ ProcessPageListActions.php

/wire/modules/Process/ProcessPageList/ ProcessPageListRender.php

/wire/modules/Process/ProcessPageLister/ ProcessPageLister.module

/wire/modules/Process/ProcessPageSearch/ ProcessPageSearch.module

/wire/modules/Process/ ProcessPageSort.module

/wire/modules/Process/ ProcessPageTrash.module

/wire/modules/Process/ProcessPageType/ ProcessPageType.module

/wire/modules/Process/ ProcessPageView.module

/wire/modules/Process/ProcessPermission/ ProcessPermission.module

/wire/modules/Process/ProcessProfile/ ProcessProfile.module

/wire/modules/Process/ProcessRecentPages/ ProcessRecentPages.module

/wire/modules/Process/ProcessTemplate/ ProcessTemplate.module

/wire/modules/Process/ProcessTemplate/ ProcessTemplateExportImport.php

/wire/modules/Process/ProcessUser/ ProcessUser.module

/wire/modules/Session/SessionHandlerDB/ ProcessSessionDB.module

/wire/modules/Session/SessionHandlerDB/ SessionHandlerDB.module

/wire/modules/Session/SessionLoginThrottle/ SessionLoginThrottle.module

/wire/modules/System/SystemNotifications/ FieldtypeNotifications.module

/wire/modules/System/SystemNotifications/ SystemNotifications.module

/wire/modules/System/SystemUpdater/ SystemUpdater.module

Hooks count: 775