function accessibility_reporting_field_attach_view_alter

cis7 accessibility_reporting.module accessibility_reporting_field_attach_view_alter(&$output, $context)
cle7 accessibility_reporting.module accessibility_reporting_field_attach_view_alter(&$output, $context)
elmsmedia7 accessibility_reporting.module accessibility_reporting_field_attach_view_alter(&$output, $context)
icor7 accessibility_reporting.module accessibility_reporting_field_attach_view_alter(&$output, $context)
meedjum_blog7 accessibility_reporting.module accessibility_reporting_field_attach_view_alter(&$output, $context)
mooc7 accessibility_reporting.module accessibility_reporting_field_attach_view_alter(&$output, $context)

Implements hook_field_attach_view_alter().

File

sites/all/modules/ulmus/accessibility/modules/accessibility_reporting/accessibility_reporting.module, line 52

Code

function accessibility_reporting_field_attach_view_alter(&$output, $context) {
  if (user_access('report accessibility results')) {
    $js_set = drupal_static(__FUNCTION__);
    foreach ($output as $field_key => $field) {
      if (is_array($field) && isset($field['#field_name'])) {
        $field = field_info_instance($field['#entity_type'], $field['#field_name'], $field['#bundle']);
        if (isset($field['accessibility_reporting']) && $field['accessibility_reporting']) {
          if (!$js_set) {
            drupal_add_js(drupal_get_path('module', 'accessibility_reporting') . '/js/accessibility_reporting.js');
            accessibility_load();
            $js_set = TRUE;
          }
          $output[$field_key]['#pre_render'][] = '_accessibility_reporting_field_pre_render';
        }
      }
    }
  }
}