ExpressionEngine® User Guide

Legacy Documentation

You are using the documentation for version 4.3.8. Go here for the latest version.

TemplateRoute Model Extension Hooks

before_template_route_insert

before_template_route_insert($template_route, $values)

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

How it’s called:

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

void

Return type:

NULL

New in version 3.3.0.

after_template_route_insert

after_template_route_insert($template_route, $values)

Called after the template route 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_template_route_insert', $this, $this->getValues());
Parameters:
  • $template_route (object) – Current TemplateRoute model object
  • $values (array) – The TemplateRoute model object data as an array
Returns:

void

Return type:

NULL

New in version 3.3.0.

before_template_route_update

before_template_route_update($template_route, $values, $modified)

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

How it’s called:

ee()->extensions->call('before_template_route_update', $this, $this->getValues(), $modified);
Parameters:
  • $template_route (object) – Current TemplateRoute model object
  • $values (array) – The TemplateRoute 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.3.0.

after_template_route_update

after_template_route_update($template_route, $values, $modified)

Called after the template route 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_template_route_update', $this, $this->getValues(), $modified);
Parameters:
  • $template_route (object) – Current TemplateRoute model object
  • $values (array) – The TemplateRoute 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.3.0.

before_template_route_save

before_template_route_save($template_route, $values)

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

How it’s called:

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

void

Return type:

NULL

New in version 3.3.0.

after_template_route_save

after_template_route_save($template_route, $values)

Called after the template route 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_template_route_save', $this, $this->getValues());
Parameters:
  • $template_route (object) – Current TemplateRoute model object
  • $values (array) – The TemplateRoute model object data as an array
Returns:

void

Return type:

NULL

New in version 3.3.0.

before_template_route_delete

before_template_route_delete($template_route, $values)

Called before the template route 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_template_route_delete', $this, $this->getValues());
Parameters:
  • $template_route (object) – Current TemplateRoute model object
  • $values (array) – The TemplateRoute model object data as an array
Returns:

void

Return type:

NULL

New in version 3.3.0.

after_template_route_delete

after_template_route_delete($template_route, $values)

Called after the template route 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_template_route_delete', $this, $this->getValues());
Parameters:
  • $template_route (object) – Current TemplateRoute model object
  • $values (array) – The TemplateRoute model object data as an array
Returns:

void

Return type:

NULL

New in version 3.3.0.

before_template_route_bulk_delete

before_template_route_bulk_delete($delete_ids)

Called before a bulk of template route objects are deleted. If you need to do an expensive operation when template routes are deleted, it may be more efficient to handle it in bulk here.

How it’s called:

ee()->extensions->call('before_template_route_bulk_delete', $delete_ids);
Parameters:
  • $delete_ids (array) – The primary key IDs of the models being deleted
Returns:

void

Return type:

NULL

New in version 4.3.0.

after_template_route_bulk_delete

after_template_route_bulk_delete($delete_ids)

Called after a bulk of template route objects are deleted. If you need to do an expensive operation when template routes are deleted, it may be more efficient to handle it in bulk here.

How it’s called:

ee()->extensions->call('after_template_route_bulk_delete', $delete_ids);
Parameters:
  • $delete_ids (array) – The primary key IDs of the models being deleted
Returns:

void

Return type:

NULL

New in version 4.3.0.