Cookie Consent by Free Privacy Policy Generator

Development - Henshu (Zenbu Edit) for EE2

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.

Forgot your password?