public function Role::validateOptionsForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/Plugin/views/access/Role.php \Drupal\user\Plugin\views\access\Role::validateOptionsForm()
Validate the options form.
Overrides PluginBase::validateOptionsForm
File
- core/
modules/ user/ src/ Plugin/ views/ access/ Role.php, line 123 - Contains \Drupal\user\Plugin\views\access\Role.
Class
- Role
- Access plugin that provides role-based access control.
Namespace
Drupal\user\Plugin\views\accessCode
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
$role = $form_state
->getValue(array(
'access_options',
'role',
));
$role = array_filter($role);
if (!$role) {
$form_state
->setError($form['role'], $this
->t('You must select at least one role if type is "by role"'));
}
$form_state
->setValue(array(
'access_options',
'role',
), $role);
}