core/modules/filter/filter.api.php | 28 +++ core/modules/filter/filter.module | 200 +++++++++++++++++++- .../lib/Drupal/filter/Tests/FilterAPITest.php | 143 ++++++++++++++ .../lib/Drupal/filter/Tests/FilterSecurityTest.php | 19 +- core/modules/php/php.module | 1 + 5 files changed, 388 insertions(+), 3 deletions(-) diff --git a/core/modules/filter/filter.api.php b/core/modules/filter/filter.api.php index f11a528..e4d032d 100644 --- a/core/modules/filter/filter.api.php +++ b/core/modules/filter/filter.api.php @@ -59,6 +59,9 @@ * - settings callback: The name of a function that returns configuration * form elements for the filter. See hook_filter_FILTER_settings() for * details. + * - allowed tags callback: The name of a function that returns an array of + * tags that are allowed by this filter. This is only necessary for filters + * that strip away other tags. * - default settings: An associative array containing default settings for * the filter, to be applied when the filter has not been configured yet. * - prepare callback: The name of a function that escapes the content before @@ -84,6 +87,7 @@ function hook_filter_info() { 'description' => t('Allows you to restrict the HTML tags the user can use. It will also remove harmful content such as JavaScript events, JavaScript URLs and CSS styles from those tags that are not removed.'), 'process callback' => '_filter_html', 'settings callback' => '_filter_html_settings', + 'allowed tags callback' => '_filter_html_allowed_tags', 'default settings' => array( 'allowed_html' => '