Development - Zenbu
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 thefieldType
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 theentry_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 theChannelEntry
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.