function accessibility_content_field_widget_form_alter

cis7 accessibility_content.module accessibility_content_field_widget_form_alter(&$element, &$form_state, $context)
cle7 accessibility_content.module accessibility_content_field_widget_form_alter(&$element, &$form_state, $context)
elmsmedia7 accessibility_content.module accessibility_content_field_widget_form_alter(&$element, &$form_state, $context)
icor7 accessibility_content.module accessibility_content_field_widget_form_alter(&$element, &$form_state, $context)
meedjum_blog7 accessibility_content.module accessibility_content_field_widget_form_alter(&$element, &$form_state, $context)
mooc7 accessibility_content.module accessibility_content_field_widget_form_alter(&$element, &$form_state, $context)

Implements field_widget_form_alter().

File

sites/all/modules/ulmus/accessibility/modules/accessibility_content/accessibility_content.module, line 70

Code

function accessibility_content_field_widget_form_alter(&$element, &$form_state, $context) {
  if (!isset($element['#type']) || !in_array($element['#type'], array('text_format'))) {
    return;
  }
  $field = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
  $options = array();
  if (isset($field['accessibility_content_block_submit'])) {
    foreach ($field['accessibility_content_block_submit'] as $severity => $active) {
      if ($active) {
        $options[] = $severity;
      }
    }
  }
  if (!count($options)) {
    return;
  }
  drupal_add_js(array('accessibility_content_form_message' => variable_get('accessibility_disabled_form_message', t('You have been prevented from submitting this form because of the following accessibility errors.'))), 'setting');
  module_load_include('inc', 'accessibility_content');
  accessibility_content_init(array('form' => TRUE));
  $element['#attributes'] = (is_array($element['#attributes']['class'])) ? $element['#attributes']['class'] : array();
  $element['#attributes']['class'][] = 'accessible-content-check-form';
  $element['#attributes']['data-accessible-content-severity'] = implode(',', $options);
}