1 filter.api.php hook_filter_FILTER_js_settings($filter, $format, $filters)

JavaScript settings callback for hook_filter_info().

Note: This is not really a hook. The function name is manually specified via 'js settings callback' in hook_filter_info(), with this recommended callback name pattern. It is called from filter_get_js_settings().

Some filters include a JavaScript implementation of their filter that can be used in editing interfaces. This integration can be used by rich text editors to provide a better WYSIWYG experience, where the filtering is simulated in a way that helps the user understand the effects of a filter while editing content. This callback allows configuration options for a filter to be passed to the page as a JavaScript setting. As not all settings need to be passed to the client side, this function may be used to send only applicable settings.

Parameters

$filter: The filter object containing the current settings for the given format, in $filter->settings.

$format: The format object which contains the filter.

$filters: The complete list of filter objects that are enabled for the given format.

Return value

An array of settings that will be added to the page for use by this: filter's JavaScript integration.

File

core/modules/filter/filter.api.php, line 485
Hooks provided by the Filter module.

Code

function hook_filter_FILTER_js_settings($filter, $format, $filters) {
  return array(
    'myFilterSetting' => $filter->settings['my_filter_setting'],
  );
}