You are here

function _simplify_disable_globally_hidden_checkboxes in Simplify 8

Disable checkboxes to indicate fields have been hidden globally.

4 string references to '_simplify_disable_globally_hidden_checkboxes'
simplify_form_block_content_type_edit_form_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for block_content_type_edit_form().
simplify_form_comment_type_edit_form_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for node_type_form().
simplify_form_node_type_edit_form_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for node_type_form().
simplify_form_taxonomy_vocabulary_form_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for taxonomy_form_vocabulary().

File

./simplify.module, line 620
Hooks implemented by the simplify module.

Code

function _simplify_disable_globally_hidden_checkboxes($element, &$form_state) {

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

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