You are here

function authcache_validate_role_restrict in Authenticated User Page Caching (Authcache) 7.2

Validation callback for authcache_role_restrict element.

Related topics

1 string reference to 'authcache_validate_role_restrict'
authcache_element_info in ./authcache.module
Implements hook_element_info().

File

./authcache.module, line 1192
Authenticated User Page Caching (and anonymous users, too!)

Code

function authcache_validate_role_restrict($element, &$form_state) {
  $value = $element['#value'];

  // Set value to NULL when custom role restrictions is not selected.
  if (empty($element['custom']['#value'])) {
    $value = NULL;
  }
  elseif (empty($value['roles'])) {
    $value['roles'] = array();
  }
  else {
    $value['roles'] = array_filter($value['roles']);
  }
  form_set_value($element, $value, $form_state);
}