You are here

function _field_permissions_make_elements_non_required in Field Permissions 7

Sets the #required property to FALSE recursively on form elements.

1 call to _field_permissions_make_elements_non_required()
field_permissions_field_attach_form in ./field_permissions.module
Implements hook_field_attach_form().

File

./field_permissions.module, line 322
This is the main script for the Field Permissions module. It merely contains the implementation of hooks invoked by Drupal core and CCK. All common functions are externalized into several scripts that are included on demand to save memory consumption…

Code

function _field_permissions_make_elements_non_required(&$elements) {
  if (!is_array($elements)) {
    return;
  }
  if (!empty($elements['#required'])) {
    $elements['#required'] = FALSE;
  }
  foreach (element_children($elements) as $key) {
    _field_permissions_make_elements_non_required($elements[$key]);
  }
}