ExpressionEngine

2.11.9 User Guide

Retired Documentation

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

Design Controller Extension Hooks

edit_template_start

edit_template_start($query, $template_id, $message)

Additional processing / take over at the beginning of the edit_template() method.

How it’s called:

$this->extensions->call('edit_template_start', $query, $template_id, $message);
if ($this->extensions->end_script === TRUE) return;
Parameters:
  • $query (object) – Database result object for the selected template
  • $template_id (int) – Selected template’s ID
  • $message (string) – Update/error message from update action, if applicable
Return type:

Void

New in version 1.6.0.

template_types

template_types()

Add template types to ExpressionEngine’s default set. In the Output library specifically, it is useful to return the appropriate content type header for the template type.

How it’s called:

$template_types = $EE->extensions->call('template_types');
Returns:The custom templates array (see below)
Return type:Array

This hook must append a key to the $last_call array in the following format:

$custom_templates = ee()->extensions->last_call;

$custom_templates['ical'] = array(             // Short name for database
    'template_name'           => 'iCal Feed',  // Display name for Template Type dropdown
    'template_file_extension' => '.ics',       // File extension for saving templates as files
    'template_headers'        => array(        // Custom headers for file type
        'Content-Type: text/ical',
        'Content-Disposition: attachment; filename="event.ics"'
    )
);

Note

It is good practice to clean up the templates table and remove your custom template type from templates using it upon extension uninstallation.

New in version 2.4.0.

update_template_end

update_template_end($template_id, $message)

Additional processing after a template is updated

How it’s called:

$this->extensions->call('update_template_end', $template_id, $message);
if ($this->extensions->end_script === TRUE) return;
Parameters:
  • $template_id (int) – Selected template’s ID
  • $message (string) – Update/error message from update action, if applicable
Return type:

Void

New in version 1.6.0.