You are here

function field_permissions_field_attach_form in Field Permissions 7

Implements hook_field_attach_form().

File

./field_permissions.module, line 309
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_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {

  // Some fields are validated if they are #required even if field's #access
  // property is set to false. For example: file/image fields, options fields.
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['#access']) && !$form[$key]['#access']) {
      _field_permissions_make_elements_non_required($form[$key]);
    }
  }
}