ExpressionEngine® 3 User Guide

Legacy Documentation

You are using the documentation for version 3.5.17. Go here for the latest version or check here for your available upgrades to the latest version.

Category Model Extension Hooks

before_category_insert

before_category_insert($category, $values)

Called before the category object is inserted. Changes made to the object will be saved automatically.

How it’s called:

ee()->extensions->call('before_category_insert', $this, $this->getValues());
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_category_insert

after_category_insert($category, $values)

Called after the category object is inserted. Changes made to the object object will not be saved automatically. Saving the object may trigger the save and update hooks.

How it’s called:

ee()->extensions->call('after_category_insert', $this, $this->getValues());
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

before_category_update

before_category_update($category, $values, $modified)

Called before the category object is updated. Changes made to the object will be saved automatically.

How it’s called:

ee()->extensions->call('before_category_update', $this, $this->getValues(), $modified);
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
  • $modified (array) – An array of all the old values that were changed
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_category_update

after_category_update($category, $values, $modified)

Called after the category object is updated. Changes made to the object will not be saved automatically. Calling save may fire additional hooks.

How it’s called:

ee()->extensions->call('after_category_update', $this, $this->getValues(), $modified);
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
  • $modified (array) – An array of all the old values that were changed
Returns:

void

Return type:

NULL

New in version 3.1.0.

before_category_save

before_category_save($category, $values)

Called before the category object is inserted or updated. Changes made to the object will be saved automatically.

How it’s called:

ee()->extensions->call('before_category_save', $this, $this->getValues());
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_category_save

after_category_save($category, $values)

Called after the category object is inserted or updated. Changes made to the object will not be saved automatically. Calling save may fire additional hooks.

How it’s called:

ee()->extensions->call('after_category_save', $this, $this->getValues());
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

before_category_delete

before_category_delete($category, $values)

Called before the category object is deleted. If you are conditionally deleting one of your own models, please consider creating an inverse relationship instead. This will provide better performance and strictly enforce data consistency.

How it’s called:

ee()->extensions->call('before_category_delete', $this, $this->getValues());
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.

after_category_delete

after_category_delete($category, $values)

Called after the category object is deleted. If you are conditionally deleting one of your own models, please consider creating an inverse relationship instead. This will provide better performance and strictly enforce data consistency.

How it’s called:

ee()->extensions->call('after_category_delete', $this, $this->getValues());
Parameters:
  • $category (object) – Current Category model object
  • $values (array) – The Category model object data as an array
Returns:

void

Return type:

NULL

New in version 3.1.0.