Hooks and Callbacks

The class methods corresponding to the name of the below actions and filters can be extended to modify the page output. Those methods are the callbacks of the filters and actions.

Methods and Action Hooks

  • start_ + extended class name – triggered at the end of the class constructor.
  • do_before_ + page slug – triggered before rendering the page.
  • do_ + page slug – triggered in the middle of rendering the page.
  • do_after_ + page slug – triggered after rendering the page.
  • do_before_ + page slug + _ + tab slug – triggered before rendering the page.
  • do_ + page slug + _ + tab slug – triggered in the middle of rendering the page.
  • do_after_ + page slug + _ + tab slug – triggered after rendering the page.
  • do_before_ + extended class name – triggered before rendering the page. It applies to all pages created by the instantiated class object.
  • do_ + extended class name – triggered in the middle of rendering the page. It applies to all pages created by the instantiated class object.
  • do_after_ + extended class name – triggered after rendering the page. It applies to all pages created by the instantiated class object.

Methods and Filters

  • head_ + page slug – receives the output of the top part of the page.
  • content_ + page slug – receives the output of the middle part of the page including form input fields.
  • foot_ + page slug – receives the output of the bottom part of the page.
  • head_ + page slug + _ + tab slug – receives the output of the top part of the page.
  • content_ + page slug + _ + tab slug – receives the output of the middle part of the page including form input fields.
  • foot_ + page slug + _ + tab slug – receives the output of the bottom part of the page.
  • head_ + extended class name – receives the output of the top part of the page, applied to all pages created by the instantiated class object.
  • content_ + extended class name – receives the output of the middle part of the page, applied to all pages created by the instantiated class object.
  • foot_ + extended class name – receives the output of the bottom part of the page, applied to all pages created by the instantiated class object.
  • section_ + section ID – receives the description output of the given form section ID. The first parameter: output string. Second parameter: the array of option.
  • field_ + field ID – receives the form input field output of the given input field ID. The first parameter: output string. Second parameter: the array of option.
  • validation_ + page slug – receives the form submission values as array.
  • validation_ + page slug + _ + tab slug – receives the form submission values as array.
  • style_ + page slug + _ + tab slug – receives the output of the CSS rules applied to the tab page of the slug.
  • style_ + page slug – receives the output of the CSS rules applied to the page of the slug.
  • style_ + extended class name – receives the output of the CSS rules applied to the pages added by the instantiated class object.
  • script_ + page slug + _ + tab slug – receives the output of the JavaScript script applied to the tab page of the slug.
  • script_ + page slug – receives the output of the JavaScript script applied to the page of the slug.
  • script_ + extended class name – receives the output of the JavaScript script applied to the pages added by the instantiated class object.
  • export_ + page slug + _ + tab slug – receives the exporting array sent from the tab page.
  • export_ + page slug – receives the exporting array submitted from the page.
  • export_ + extended class name – receives the exporting array submitted from the plugin.
  • import_ + page slug + _ + tab slug – receives the importing array submitted from the tab page.
  • import_ + page slug – receives the importing array submitted from the page.
  • import_ + extended class name – receives the importing array submitted from the plugin.

Remarks

The slugs must not contain a dot(.) or a hyphen(-) since it is used in the callback method name.

Examples

If the extended class name is Sample_Admin_Pages, defining the following class method will embed a banner image in all pages created by the class.

If the created page slug is my_first_setting_page, defining the following class method will filter the middle part of the page output.

Timing of Hooks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">