function media_wysiwyg_button_element_validate in D7 Media 7
Element validate callback for the media WYSIWYG button.
1 string reference to 'media_wysiwyg_button_element_validate'
- media_form_wysiwyg_profile_form_alter in ./
media.module - Implements hook_form_FORM_ID_alter().
File
- wysiwyg_plugins/
media.inc, line 72 - Define the WYSIWYG browser plugin.
Code
function media_wysiwyg_button_element_validate($element, &$form_state) {
if (!empty($element['#value'])) {
$format = filter_format_load($form_state['build_info']['args'][0]->format);
$filters = filter_list_format($format->format);
if (empty($filters['media_filter']->status)) {
form_error($element, t('The <em>Convert Media tags to markup</em> filter must be enabled for the <a href="@format-link">@format format</a> in order to use the Media browser WYSIWYG button.', array(
'@format-link' => url('admin/config/content/formats/' . $format->format, array(
'query' => array(
'destination' => $_GET['q'],
),
)),
'@format' => $format->name,
)));
}
}
return $element;
}