function _htmlpurifier_set_config in HTML Purifier 7.2
Fills out the form state with extra post data originating from the HTML Purifier configuration form. This is an #after_build hook function.
1 string reference to '_htmlpurifier_set_config'
- _htmlpurifier_settings in ./
htmlpurifier.module - Generates a settings form for configuring HTML Purifier.
File
- ./
htmlpurifier.module, line 686 - Implements HTML Purifier as a Drupal filter.
Code
function _htmlpurifier_set_config($form_element, &$form_state) {
if (isset($form_state['input']['htmlpurifier_config'])) {
// Copy over the values from the custom HTML Purifier Config form into the settings array
$form_state['values']['filters']['htmlpurifier']['settings']['htmlpurifier_config'] = $form_state['input']['htmlpurifier_config'];
// Do some sanity checking for CSSTidy
$htmlpurifier_config = $form_state['input']['htmlpurifier_config'];
if (!empty($htmlpurifier_config['Filter.ExtractStyleBlocks'])) {
if (!empty($htmlpurifier_config['Null_Filter.ExtractStyleBlocks.Scope'])) {
dpm($htmlpurifier_config['Null_Filter.ExtractStyleBlocks.Scope']);
drupal_set_message("You have not set <code>Filter.ExtractStyleBlocks.Scope</code>; this means that users can add CSS that affects all of your Drupal theme and not just their content block. It is recommended to set this to <code>#node-[%HTMLPURIFIER:NID%]</code> (including brackets) which will automatically ensure that CSS directives only apply to their node.", 'warning', FALSE);
}
elseif (!isset($htmlpurifier_config['Filter.ExtractStyleBlocks.Scope']) || $htmlpurifier_config['Filter.ExtractStyleBlocks.Scope'] !== '#node-[%HTMLPURIFIER:NID%]') {
drupal_set_message("You have enabled Filter.ExtractStyleBlocks.Scope, but you did not set it to <code>#node-[%HTMLPURIFIER:NID%]</code>; CSS may not work unless you have special theme support.", 'warning', FALSE);
}
}
}
return $form_element;
}