Cookie Consent by Free Privacy Policy Generator

Development - Zenbu + Hokoku Bundle

Are you a third-party fieldtype developer? Do you want to add or tweak compatibility for your fieldtype?

If your fieldtype doesn’t already work fine with Henshu (displaying and saving of data), you can either tweak your fieldtype with its standard methods, or tweak it by adding a Henshu compatibility functions in your fieldtype file (see the Fieldtype Framework Functions below). These functions will allow you to process data before being saved in the database, and modify how your custom field is displayed from Henshu, for example.

Henshu first looks for Henshu functions in the third-party’s fieldtype file (ft.field.php). If Henshu functions are not found, Henshu looks for fieldtype support files corresponding to a fieldtype in the Henshu/fieldtypes folder. The fallback is Henshu displaying and procesing the field using its default methods.

Examples of compatibility files can be found in Henshu under /system/expressionengine/third_party/henshu/fieldtypes.

Fieldtype Framework Functions


henshu_add_extra_output

(Since 0.7.0)

Add extra scripts, styles, etc, after the Henshu custom field edit form is opened in the view.

henshu_add_extra_output($field_data, $entry_id, $field_id)

Parameters

  • $field_data: (string) The field data as queried in exp_channel_data
  • $entry_id: (int) The entry ID of this single result entry
  • $field_id: (int) The ID of this field

Return

$return: (mixed) The data to be added along with the custom field.


henshu_pre_save

(Since 1.0.0)

Extra processing of data before the save() routine is launched.

henshu_pre_save($new_data, $entry_id, $field_id)

Parameters

  • $new_data: (mixed) The new data to be submitted
  • $entry_id: (int) The entry ID of this single result entry
  • $field_id: (int) The ID of this field

Return

$return: (mixed) The data to be passed in your fieldtype’s save() method. Data MUST be returned.


henshu_process_save_data

(Deprecated since 0.7.0)

Process data for your fieldtype save() method’s special needs when called from the EE Channel Entries API

henshu_process_save_data($field_data, $entry_id, $field_id)

Parameters

  • $field_data: (string) The field data as queried in exp_channel_data
  • $entry_id: (int) The entry ID of this single result entry
  • $field_id: (int) The ID of this field

Return

$return: (mixed) The data to be passed in your fieldtype’s save() method.

Looking for a way to add your own custom fields? See Zenbu Total Revisions, an example addon that shows one way to add your own custom fields in Zenbu.

Note: The hooks can also be used to add support for a custom field, such as third-party fieldtypes.

Hooks

zenbu_modify_results

Allows you to modify the Zenbu search result array.

Arguments

$output (array): This contains the Zenbu search result data (both raw and processed for Zenbu display), as well as pagination data and display settings data.

  • Adding to the $output['display_settings'] array will add a column to Zenbu.
  • Adding to the $output['data'] array will make your key/value available to Zenbu for display. A key matching the fieldType value in $output['display_settings'] will enable the data value to be displayed in Zenbu.
  • Modifying $output['data'] can also be used to modify the already available data, eg. wrap the entry_id with a link to the entry form.

zenbu_main_content_end

The zenbu_main_content_end hook can be used to add markup or scripts at the very end of the Zenbu main page. This can be used, for example, to register language strings in javascript. Zenbu can then retrieve the string for display as the column header text, for example. Handy for adding modal windows, debug info, etc.

zenbu_modify_query

Modify the query, right before the final ->all() call.

Arguments

  • $query: You need to pass this since this is what you’ll be modifying. The query is on the ChannelEntry model.
  • $custom_fields (collection): A list of custom fields available for the currently selected channel, or all channels.
  • $filters (array): The current search filters.

zenbu_add_nav_content

Adds the ability to add content (eg. markup for a button) to the top-right action buttons on Zenbu’s main page.

Development documentation

In its simplest form, Zenbu natively displays the contents of a custom field stored in the exp_channel_data table. For customized display of custom field data, Zenbu already supports a number of custom fieldtypes, but third-party developers can add their own customized support for their fieldtype.

Zenbu first looks for Zenbu functions in the third-party’s fieldtype file (ft.field.php). If Zenbu functions are not found, Zenbu looks for fieldtype support files corresponding to a fieldtype in the zenbu/fieldtypes folder. As a final fallback, if Zenbu functions are still not found, the content of the data stored in exp_channel_data is displayed. (Note: The first two steps were reversed before v1.5.5)

Fieldtype framework functions

zenbu_display

Set up display in entry result cell

zenbu_display($entry_id, $channel_id, $data, $table_data, $field_id, $settings, $rules, $upload_prefs, $installed_addons)

Parameters

  • $entry_id: (int) The entry ID of this single result entry
  • $channel_id: (int) The channel ID associated to this single result entry
  • $data: (array) Raw data as found in database cell in exp_channel_data
  • $table_data: (array) Data array usually retrieved from other table than exp_channel_data
  • $field_id: (int) The ID of this field
  • $settings: (array) The settings array, containing saved field order, display, extra options etc settings
  • $rules: (array) An array of entry filtering rules
  • $upload_prefs: (array) An array of upload preferences (optional)
  • $installed_addons: (array) An array of installed addons and their version numbers (optional)
  • $fieldtypes: (array) Fieldtype of available fieldtypes: id, name, etc (optional)

Return

$output: (string) The HTML used to display data


zenbu_get_table_data

Retrieve data stored in other database tables based on results from Zenbu’s entry list.

Instead of many small queries, this function can be used to carry out a single query of data to be later processed by the zenbu_display() method.

zenbu_get_table_data($entry_ids, $field_ids, $channel_id, $output_upload_prefs, $settings, $rel_array)

Parameters

  • $entry_ids: (array) An array of entry IDs from Zenbu’s entry listing results
  • $field_ids: (array) An array of field IDs tied to/associated with result entries
  • $channel_id: (int) The ID of the channel in which Zenbu searched entries (0 = “All channels”)
  • $output_upload_prefs: (array) An array of upload preferences
  • $settings: (array) The settings array, containing saved field order, display, extra options etc settings (optional)
  • $rel_array: (array) A simple array useful when using related entry-type fields (optional)

Return

$output: (array) An array of data (typically broken down by entry_id then field_id)


zenbu_result_query

Extra queries to be integrated into main entry result query

zenbu_result_query($rules, $field_id, $fieldtypes, $already_queried, $installed_addons)

Parameters

  • $rules: (int) An array of entry filtering rules
  • $field_id: (array) The ID of this field
  • $fieldtypes: (array) $fieldtype data
  • $already_queried: (bool) Used to avoid using a FROM statement for the same field twice
  • $installed_addons: (array) An array of installed addons and their version numbers (optional)

Return

Void. A query to be integrated with entry results should be mentioned. Should be in CI Active Record format (eg. $this->EE->db->…)


zenbu_field_extra_settings

Set up display for this fieldtype in “display settings”

zenbu_field_extra_settings($table_col, $channel_id, $extra_options)

Parameters

  • $table_col: (string) A Zenbu table column name to be used for settings and input field labels
  • $channel_id: (int) The channel ID for this field
  • $extra_options: (array) The Zenbu field settings, used to retieve pre-saved data

Return

$output: (array) An array with option names as key, and field settings to display (in HTML) as values.



Hooks

Miscellaneous

Modifying existing fields

Adding columns to Zenbu

zenbu_filter_by_status

Enables the addition of extra queries when filtering entries by status

if ($this->EE->extensions->active_hook('zenbu_filter_by_status') === TRUE)
{
    $where = $this->EE->extensions->call('zenbu_filter_by_status', $channel_id, $status, $rule, $where);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $channel_id: (int) The currently selected channel_id
  • $status: (string) The currently selected status
  • $rule: (array) The current entry filter rule array
  • $where: (string) The partial query string

Return

$where: (string) The modified query string


zenbu_entry_query_end

Any last words? Enables adding additional Active Record patterns/commands before committing the completed Active Record query

if ($this->EE->extensions->active_hook('zenbu_entry_query_end') === TRUE)
{
    $this->EE->extensions->call('zenbu_entry_query_end');
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

None

Return

Void


zenbu_after_save_search

Enables the addition of extra code after the “Save this search” link

if ($this->EE->extensions->active_hook('zenbu_after_save_search') === TRUE)
{
    $vars_other['extra_options_right_save'] = $this->EE->extensions->call('zenbu_after_save_search');
    if ($this->EE->extensions->end_script === TRUE) return;
} else {
    $vars_other['extra_options_right_save'] = '';
}

Parameters

None

Return

$vars_other[‘extra_options_right_save’] (string) The output HTML


zenbu_modify_data_array

Modifies the data array containing most of Zenbu’s settings and output data. This data is used for the result view

if ($this->EE->extensions->active_hook('zenbu_modify_data_array') === TRUE)
{
    $vars = $this->EE->extensions->call('zenbu_modify_data_array', $vars);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $vars (array) The data array before modification

Return

  • $vars (array) The modified data array

zenbu_modify_channel_data

Modifies the channel array, used for the Zenbu channel dropdown, for example

if ($this->EE->extensions->active_hook('zenbu_modify_channel_data') === TRUE)
{
    $output = $this->EE->extensions->call('zenbu_modify_channel_data', $output);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output (array) The channel array before modification

Return

  • $output (array) An array containing channel-related data

zenbu_modify_column_headers

Modifies the labels for each visible column in Zenbu.

if ($this->EE->extensions->active_hook('zenbu_modify_column_headers') === TRUE)
{
    $column_headers = $this->EE->extensions->call('zenbu_modify_column_headers', $column_headers);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $column_headers (array) The column header titles

Return

  • $column_headers (array) The modified column header array

zenbu_modify_title_display

Modifies the display of the “title” column in the entry listing

if ($this->EE->extensions->active_hook('zenbu_modify_title_display') === TRUE)
{
    $output['entry'][$row['entry_id']]['title'] = $this->EE->extensions->call('zenbu_modify_title_display', $output['entry'][$row['entry_id']]['title'], $entry_array, $row);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output[‘entry’][$row[‘entry_id’]][‘title’]: (string) The output string to be displayed in the Zenbu column
  • $entry_array: (array) An array containing all the entry_ids of the entry listing results
  • $row: (int) An array of row data for the current entry

Return

$output[‘entry’][$row[‘entry_id’]][‘title’]: (string) The final output to be displayed in the Zenbu column


zenbu_modify_status_display

Modifies the display of the “status” column in the entry listings

if ($this->EE->extensions->active_hook('zenbu_modify_status_display') === TRUE)
{
    $output['entry'][$row['entry_id']]['status'] = $this->EE->extensions->call('zenbu_modify_status_display', $output['entry'][$row['entry_id']]['status'], $entry_array, $row, $output_status);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output[‘entry’][$row[‘entry_id’]][‘status’]: (string) The output string to be displayed in the Zenbu column
  • $entry_array: (array) An array containing all the entry_ids of the entry listing results
  • $row: (int) An array of row data for the current entry
  • $statuses: (array) An array containing all entry status data

Return

$output[‘entry’][$row[‘entry_id’]][‘status’]: (string) The final output to be displayed in the Zenbu column


zenbu_modify_category_display

Modifies the display of the “category” column in the entry listing.

if ($this->EE->extensions->active_hook('zenbu_modify_category_display') === TRUE)
{
    $output['entry'][$row['entry_id']]['categories'] = $this->EE->extensions->call('zenbu_modify_category_display', $output['entry'][$row['entry_id']]['categories'], $entry_array, $row, $category_list);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output (string) The output string to be displayed in the Zenbu column
  • $entry_array (array) An array containing all the entry_ids of the entry listing results
  • $row (int) An array of row data for the current entry
  • **$category_list (array) A multi-dimensional array of cat_id/cat_name, for each entry_id

Return

  • $output (string) The final output to be displayed in the Zenbu column

zenbu_modify_field_cell_data

Modify custom field cell data before output & display in Zenbu.

if ($this->EE->extensions->active_hook('zenbu_modify_field_cell_data') === TRUE)
{
    $info_data                      = $field_ids;
    $info_data['entry_id']          = $row['entry_id'];
    $info_data['current_field_id']  = $field_id;

    $field_data = $this->EE->extensions->call('zenbu_modify_field_cell_data', $field_data, $info_data);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $field_data (string) The current data to be displayed in the Zenbu column cell
  • $info_data (array) An array of the current entry_id, field_id, and an array of field information (ids, fieldtype, name…)

Return

  • $field_data (string) The modified data to be displayed in the Zenbu column cell

zenbu_modify_standard_cell_data

Modifies the display of standard entry data columns in the entry listing.

if ($this->EE->extensions->active_hook('zenbu_modify_standard_cell_data') === TRUE)
{
    $output['entry'][$row['entry_id']] = $this->EE->extensions->call('zenbu_modify_standard_cell_data', $output['entry'][$row['entry_id']], $entry_array, $row);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output (string) The output string to be displayed in the Zenbu column
  • $entry_array (array) An array containing all the entry_ids of the entry listing results
  • $row (int) An array of row data for the current entry

Return

  • $output (string) The final output to be displayed in the Zenbu column

zenbu_add_column

Adds another standard setting row in the Display Settings section.

if ($this->EE->extensions->active_hook('zenbu_add_column') === TRUE)
{
    $hook_fields_and_labels = $this->EE->extensions->call('zenbu_add_column');
    if ($this->EE->extensions->end_script === TRUE) return;
    ... /* See source for the rest */
}

Parameters

None

Return

  • $hook_fields_and_labels (array) An array containing row data. The $hook_fields_and_labels array must have the following keys along with their values:
    • column: Computer-readable used as identifier for settings, prefixed with show_. Keep it unique! For example, show_my_column
    • label: Human-readable label used in the Display settings row.

Example

$hook_fields_and_labels[] = array(
    'column'    => 'show_my_column',
    'label'     => ee()->lang->line('show_my_column'),
);

return $hook_fields_and_labels;

zenbu_entry_cell_data

Add data to display in the custom/third-party entry row cell

if ($this->EE->extensions->active_hook('zenbu_entry_cell_data') === TRUE)
{
    $ext_result_array = $this->EE->extensions->call('zenbu_entry_cell_data', $row['entry_id'], $entry_array, $row['channel_id']);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $row[‘entry_id’] (int) The current Entry ID
  • $entry_array (array) An array of all entries found by Zenbu
  • $channel_id (int) The current channel ID for the entry

Return

  • $output (array) An array of data used by Zenbu. The key must match the computer-readable identifier, minus the show_ part. For example, if the column is show_my_column, then return $output["my_column"]

Example

$output["my_column"] = "Hello World";

return $output;

zenbu_custom_order_sort

Adds custom sorting to Zenbu results

if ($this->EE->extensions->active_hook('zenbu_custom_order_sort') === TRUE)
{
    $this->EE->extensions->call('zenbu_custom_order_sort', $sort);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $sort (string) The sort order (asc or desc)

Return

  • Void: Build your order_by() Active Record statements in the extension

Note: The developer documentation below applies for the EE2 version of Zenbu. Similar functions and hooks are available in EE3, but not fully documented yet.

Development documentation

In its simplest form, Zenbu natively displays the contents of a custom field stored in the exp_channel_data table. For customized display of custom field data, Zenbu already supports a number of custom fieldtypes, but third-party developers can add their own customized support for their fieldtype.

Zenbu first looks for Zenbu functions in the third-party’s fieldtype file (ft.field.php). If Zenbu functions are not found, Zenbu looks for fieldtype support files corresponding to a fieldtype in the zenbu/fieldtypes folder. As a final fallback, if Zenbu functions are still not found, the content of the data stored in exp_channel_data is displayed. (Note: The first two steps were reversed before v1.5.5)

Fieldtype framework functions

zenbu_display

Set up display in entry result cell

zenbu_display($entry_id, $channel_id, $data, $table_data, $field_id, $settings, $rules, $upload_prefs, $installed_addons)

Parameters

  • $entry_id: (int) The entry ID of this single result entry
  • $channel_id: (int) The channel ID associated to this single result entry
  • $data: (array) Raw data as found in database cell in exp_channel_data
  • $table_data: (array) Data array usually retrieved from other table than exp_channel_data
  • $field_id: (int) The ID of this field
  • $settings: (array) The settings array, containing saved field order, display, extra options etc settings
  • $rules: (array) An array of entry filtering rules
  • $upload_prefs: (array) An array of upload preferences (optional)
  • $installed_addons: (array) An array of installed addons and their version numbers (optional)
  • $fieldtypes: (array) Fieldtype of available fieldtypes: id, name, etc (optional)

Return

$output: (string) The HTML used to display data


zenbu_get_table_data

Retrieve data stored in other database tables based on results from Zenbu’s entry list.

Instead of many small queries, this function can be used to carry out a single query of data to be later processed by the zenbu_display() method.

zenbu_get_table_data($entry_ids, $field_ids, $channel_id, $output_upload_prefs, $settings, $rel_array)

Parameters

  • $entry_ids: (array) An array of entry IDs from Zenbu’s entry listing results
  • $field_ids: (array) An array of field IDs tied to/associated with result entries
  • $channel_id: (int) The ID of the channel in which Zenbu searched entries (0 = “All channels”)
  • $output_upload_prefs: (array) An array of upload preferences
  • $settings: (array) The settings array, containing saved field order, display, extra options etc settings (optional)
  • $rel_array: (array) A simple array useful when using related entry-type fields (optional)

Return

$output: (array) An array of data (typically broken down by entry_id then field_id)


zenbu_result_query

Extra queries to be integrated into main entry result query

zenbu_result_query($rules, $field_id, $fieldtypes, $already_queried, $installed_addons)

Parameters

  • $rules: (int) An array of entry filtering rules
  • $field_id: (array) The ID of this field
  • $fieldtypes: (array) $fieldtype data
  • $already_queried: (bool) Used to avoid using a FROM statement for the same field twice
  • $installed_addons: (array) An array of installed addons and their version numbers (optional)

Return

Void. A query to be integrated with entry results should be mentioned. Should be in CI Active Record format (eg. $this->EE->db->…)


zenbu_field_extra_settings

Set up display for this fieldtype in “display settings”

zenbu_field_extra_settings($table_col, $channel_id, $extra_options)

Parameters

  • $table_col: (string) A Zenbu table column name to be used for settings and input field labels
  • $channel_id: (int) The channel ID for this field
  • $extra_options: (array) The Zenbu field settings, used to retieve pre-saved data

Return

$output: (array) An array with option names as key, and field settings to display (in HTML) as values.



Hooks

Miscellaneous

Modifying existing fields

Adding columns to Zenbu

zenbu_filter_by_status

Enables the addition of extra queries when filtering entries by status

if ($this->EE->extensions->active_hook('zenbu_filter_by_status') === TRUE)
{
    $where = $this->EE->extensions->call('zenbu_filter_by_status', $channel_id, $status, $rule, $where);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $channel_id: (int) The currently selected channel_id
  • $status: (string) The currently selected status
  • $rule: (array) The current entry filter rule array
  • $where: (string) The partial query string

Return

$where: (string) The modified query string


zenbu_entry_query_end

Any last words? Enables adding additional Active Record patterns/commands before committing the completed Active Record query

if ($this->EE->extensions->active_hook('zenbu_entry_query_end') === TRUE)
{
    $this->EE->extensions->call('zenbu_entry_query_end');
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

None

Return

Void


zenbu_after_save_search

Enables the addition of extra code after the “Save this search” link

if ($this->EE->extensions->active_hook('zenbu_after_save_search') === TRUE)
{
    $vars_other['extra_options_right_save'] = $this->EE->extensions->call('zenbu_after_save_search');
    if ($this->EE->extensions->end_script === TRUE) return;
} else {
    $vars_other['extra_options_right_save'] = '';
}

Parameters

None

Return

$vars_other[‘extra_options_right_save’] (string) The output HTML


zenbu_modify_data_array

Modifies the data array containing most of Zenbu’s settings and output data. This data is used for the result view

if ($this->EE->extensions->active_hook('zenbu_modify_data_array') === TRUE)
{
    $vars = $this->EE->extensions->call('zenbu_modify_data_array', $vars);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $vars (array) The data array before modification

Return

  • $vars (array) The modified data array

zenbu_modify_channel_data

Modifies the channel array, used for the Zenbu channel dropdown, for example

if ($this->EE->extensions->active_hook('zenbu_modify_channel_data') === TRUE)
{
    $output = $this->EE->extensions->call('zenbu_modify_channel_data', $output);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output (array) The channel array before modification

Return

  • $output (array) An array containing channel-related data

zenbu_modify_column_headers

Modifies the labels for each visible column in Zenbu.

if ($this->EE->extensions->active_hook('zenbu_modify_column_headers') === TRUE)
{
    $column_headers = $this->EE->extensions->call('zenbu_modify_column_headers', $column_headers);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $column_headers (array) The column header titles

Return

  • $column_headers (array) The modified column header array

zenbu_modify_title_display

Modifies the display of the “title” column in the entry listing

if ($this->EE->extensions->active_hook('zenbu_modify_title_display') === TRUE)
{
    $output['entry'][$row['entry_id']]['title'] = $this->EE->extensions->call('zenbu_modify_title_display', $output['entry'][$row['entry_id']]['title'], $entry_array, $row);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output[‘entry’][$row[‘entry_id’]][‘title’]: (string) The output string to be displayed in the Zenbu column
  • $entry_array: (array) An array containing all the entry_ids of the entry listing results
  • $row: (int) An array of row data for the current entry

Return

$output[‘entry’][$row[‘entry_id’]][‘title’]: (string) The final output to be displayed in the Zenbu column


zenbu_modify_status_display

Modifies the display of the “status” column in the entry listings

if ($this->EE->extensions->active_hook('zenbu_modify_status_display') === TRUE)
{
    $output['entry'][$row['entry_id']]['status'] = $this->EE->extensions->call('zenbu_modify_status_display', $output['entry'][$row['entry_id']]['status'], $entry_array, $row, $output_status);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output[‘entry’][$row[‘entry_id’]][‘status’]: (string) The output string to be displayed in the Zenbu column
  • $entry_array: (array) An array containing all the entry_ids of the entry listing results
  • $row: (int) An array of row data for the current entry
  • $statuses: (array) An array containing all entry status data

Return

$output[‘entry’][$row[‘entry_id’]][‘status’]: (string) The final output to be displayed in the Zenbu column


zenbu_modify_category_display

Modifies the display of the “category” column in the entry listing.

if ($this->EE->extensions->active_hook('zenbu_modify_category_display') === TRUE)
{
    $output['entry'][$row['entry_id']]['categories'] = $this->EE->extensions->call('zenbu_modify_category_display', $output['entry'][$row['entry_id']]['categories'], $entry_array, $row, $category_list);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output (string) The output string to be displayed in the Zenbu column
  • $entry_array (array) An array containing all the entry_ids of the entry listing results
  • $row (int) An array of row data for the current entry
  • **$category_list (array) A multi-dimensional array of cat_id/cat_name, for each entry_id

Return

  • $output (string) The final output to be displayed in the Zenbu column

zenbu_modify_field_cell_data

Modify custom field cell data before output & display in Zenbu.

if ($this->EE->extensions->active_hook('zenbu_modify_field_cell_data') === TRUE)
{
    $info_data                      = $field_ids;
    $info_data['entry_id']          = $row['entry_id'];
    $info_data['current_field_id']  = $field_id;

    $field_data = $this->EE->extensions->call('zenbu_modify_field_cell_data', $field_data, $info_data);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $field_data (string) The current data to be displayed in the Zenbu column cell
  • $info_data (array) An array of the current entry_id, field_id, and an array of field information (ids, fieldtype, name…)

Return

  • $field_data (string) The modified data to be displayed in the Zenbu column cell

zenbu_modify_standard_cell_data

Modifies the display of standard entry data columns in the entry listing.

if ($this->EE->extensions->active_hook('zenbu_modify_standard_cell_data') === TRUE)
{
    $output['entry'][$row['entry_id']] = $this->EE->extensions->call('zenbu_modify_standard_cell_data', $output['entry'][$row['entry_id']], $entry_array, $row);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $output (string) The output string to be displayed in the Zenbu column
  • $entry_array (array) An array containing all the entry_ids of the entry listing results
  • $row (int) An array of row data for the current entry

Return

  • $output (string) The final output to be displayed in the Zenbu column

zenbu_add_column

Adds another standard setting row in the Display Settings section.

if ($this->EE->extensions->active_hook('zenbu_add_column') === TRUE)
{
    $hook_fields_and_labels = $this->EE->extensions->call('zenbu_add_column');
    if ($this->EE->extensions->end_script === TRUE) return;
    ... /* See source for the rest */
}

Parameters

None

Return

  • $hook_fields_and_labels (array) An array containing row data. The $hook_fields_and_labels array must have the following keys along with their values:
    • column: Computer-readable used as identifier for settings, prefixed with show_. Keep it unique! For example, show_my_column
    • label: Human-readable label used in the Display settings row.

Example

$hook_fields_and_labels[] = array(
    'column'    => 'show_my_column',
    'label'     => ee()->lang->line('show_my_column'),
);

return $hook_fields_and_labels;

zenbu_entry_cell_data

Add data to display in the custom/third-party entry row cell

if ($this->EE->extensions->active_hook('zenbu_entry_cell_data') === TRUE)
{
    $ext_result_array = $this->EE->extensions->call('zenbu_entry_cell_data', $row['entry_id'], $entry_array, $row['channel_id']);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $row[‘entry_id’] (int) The current Entry ID
  • $entry_array (array) An array of all entries found by Zenbu
  • $channel_id (int) The current channel ID for the entry

Return

  • $output (array) An array of data used by Zenbu. The key must match the computer-readable identifier, minus the show_ part. For example, if the column is show_my_column, then return $output["my_column"]

Example

$output["my_column"] = "Hello World";

return $output;

zenbu_custom_order_sort

Adds custom sorting to Zenbu results

if ($this->EE->extensions->active_hook('zenbu_custom_order_sort') === TRUE)
{
    $this->EE->extensions->call('zenbu_custom_order_sort', $sort);
    if ($this->EE->extensions->end_script === TRUE) return;
}

Parameters

  • $sort (string) The sort order (asc or desc)

Return

  • Void: Build your order_by() Active Record statements in the extension

Forgot your password?