function entityform_anonymous_entityform_type_form_validate in Entityform 7.2
Validation callback for entityform_type_form
Ensures that anonymous users have access to entityform types with anonymous tracking.
_state
Parameters
$form:
1 string reference to 'entityform_anonymous_entityform_type_form_validate'
- entityform_anonymous_form_entityform_type_form_alter in entityform_anonymous/
entityform_anonymous.module - Implements hook_form_FORM_ID_alter(): entityform_type_form.
File
- entityform_anonymous/
entityform_anonymous.module, line 210 - Main functions and hook implementations
Code
function entityform_anonymous_entityform_type_form_validate($form, &$form_state) {
$data = $form_state['values']['data'];
$roles = array_filter($data['roles']);
if (!in_array(DRUPAL_ANONYMOUS_RID, $roles) && ($data['anonymous_links'] || $data['session_save'])) {
form_error($form['data']['access_set']['roles'], t('You have set anonymous tracking but anonymous users don\'t have access to the form'));
}
}