You are here

function editablefields_form_alter in Editable Fields 6.3

Same name and namespace in other branches
  1. 5.3 editablefields.module \editablefields_form_alter()
  2. 5 editablefields.module \editablefields_form_alter()
  3. 5.2 editablefields.module \editablefields_form_alter()

Implementation of hook_form_alter().

File

./editablefields.module, line 199
Editable fields module.

Code

function editablefields_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'content_display_overview_form') {

    // Remove editable field formatters from the options.
    if ($form['#contexts'] == 'editablefields') {
      $formatters = editablefields_field_formatter_info();
      foreach ($form as $key => &$element) {
        if (substr($key, 0, 6) == 'field_') {
          foreach ($element as $setting_name => &$setting) {
            if (!empty($setting['format'])) {
              foreach ($formatters as $formatter_name => $formatter) {
                unset($setting['format']['#options'][$formatter_name]);
                unset($setting['format']['base']['#options'][$formatter_name]);
              }
            }
          }
        }
      }
    }
  }
}