The Trigger feature in the Greyd Plugin comes with some extra hooks to modify the rendering of the trigger. It’s also possible to manually add the functionality for a Trigger Event to other HTML elements, see the Manual Trigger Events documentation.
greyd_get_trigger_attributes
PHP
/**
* This filter can be used to modifiy the trigger attributes before they are
* applied to the html wrapper.
*
* @filter 'greyd_get_trigger_attributes'
*
* @param array $trigger_attributes Trigger Attributes:
* @property array url e.g. [ href: 'https://your-website.com', target: '_blank' ]
* @property string click e.g. 'history.back()'
* @property string hover e.g. 'greyd.trigger.trigger("toggle-01")'
* @param array $block The block with all its attributes.
*
* @return array $trigger_attributes Altered Trigger Attributes.
*/
return apply_filters('greyd_get_trigger_attributes', $trigger, $block);
greyd_merge_trigger_html_atts
PHP
/**
* This filter can be used to modifiy the html attributes of the trigger after
* they are merged with other html wrapper attributes.
*
* @filter 'greyd_merge_trigger_html_atts'
*
* @param array $html_atts Altered html wrapper attributes.
* @param array $trigger_attributes Trigger Attributes:
* @property array url e.g. [ href: 'https://your-website.com', target: '_blank' ]
* @property string click e.g. 'history.back()'
* @property string hover e.g. 'greyd.trigger.trigger("toggle-01")'
*
* @return array $html_atts Altered html wrapper attributes.
*/
return apply_filters('greyd_merge_trigger_html_atts', $html_atts, $trigger_attributes);
greyd_merge_greyd_javascript_trigger_html_atts
PHP
/**
* This filter can be used to modifiy the html attributes of custom greyd trigger
* events.
*
* @filter 'greyd_merge_greyd_javascript_trigger_html_atts'
*
* @param array $html_atts Altered html wrapper attributes.
* @param object $attrs The Block Attributes.
*
* @return array $html_atts Altered html wrapper attributes.
*/
return apply_filters('greyd_merge_greyd_javascript_trigger_html_atts', $html_atts, $attrs);
greyd_get_trigger_html_attributes_string
PHP
/**
* This filter can be used to modifiy the html attributes of the trigger after
* they are merged with other html wrapper attributes and converted to a string
* to then be replaced in the button markup.
*
* @filter 'greyd_get_trigger_html_attributes_string'
*
* @param string $replace Partial string to replace 'role' attribute in button markup.
* @param array $trigger_attributes Trigger Attributes:
* @property array url e.g. [ href: 'https://your-website.com', target: '_blank' ]
* @property string click e.g. 'history.back()'
* @property string hover e.g. 'greyd.trigger.trigger("toggle-01")'
*
* @return string $replace Partial string to replace 'role' attribute in button markup.
*/
return apply_filters('greyd_get_trigger_html_attributes_string', $replace, $trigger_attributes);