You are here

function _spaces_make_hidden in Spaces 5

Set all elements in a given form to 'value'. Using value preserves the tree and prevents The element from being rendered.

2 calls to _spaces_make_hidden()
_spaces_form_alter_group in ./spaces.module
_spaces_form_alter_node in ./spaces.module

File

./spaces.module, line 369

Code

function _spaces_make_hidden(&$form) {
  if (isset($form['#type'])) {
    $form['#type'] = 'value';
    $form['#required'] = false;
  }
  if (is_array($form)) {
    foreach ($form as $key => $value) {
      if (is_array($value) && strpos($key, '#') !== 0) {
        _spaces_make_hidden($form[$key]);
      }
    }
  }
}