You are here

function simplify_disable_globally_hidden_checkboxes in Simplify 7.3

Disable checkboxes to indicate fields have been hidden globally.

3 string references to 'simplify_disable_globally_hidden_checkboxes'
simplify_form_node_type_form_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for node_type_form.
simplify_form_profile2_type_form_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for profile2_type_form.
simplify_form_taxonomy_form_vocabulary_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for taxonomy_form_vocabulary.

File

./simplify.module, line 314
Simplifies the user interface by hiding particular fields.

Code

function simplify_disable_globally_hidden_checkboxes($element, &$form_state) {

  // Get globally hidden fields
  $global_fields = variable_get($element['#name'] . '_global', array());

  // Disable any globally hidden fields
  foreach (element_children($element) as $field) {
    if (in_array($field, $global_fields)) {
      $element[$field]['#checked'] = TRUE;
      $element[$field]['#attributes']['disabled'] = 'disabled';
    }
  }
  return $element;
}