You are here

function simplify_hide_text_format_elements in Simplify 7.3

Same name and namespace in other branches
  1. 8 simplify.module \simplify_hide_text_format_elements()

Recurse through the provided form and hide any text_format elements.

1 call to simplify_hide_text_format_elements()
simplify_hide_field in ./simplify.module
Hide a given field.

File

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

Code

function simplify_hide_text_format_elements(&$form) {
  foreach (element_children($form) as $key) {
    if (!isset($form[$key]['#type'])) {
      simplify_hide_text_format_elements($form[$key]);
    }
    else {
      if (in_array($form[$key]['#type'], array(
        'container',
        'fieldset',
      ))) {
        if (isset($form[$key]['#language']) && !empty($form[$key][$form[$key]['#language']])) {
          simplify_hide_text_format_elements($form[$key][$form[$key]['#language']]);
        }
        else {
          simplify_hide_text_format_elements($form[$key]);
        }
      }
      elseif ($form[$key]['#type'] == 'text_format') {
        $form[$key]['#after_build'][] = 'simplify_hide_text_format_element';
      }
    }
  }
}