/** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $sanitized_id = ArgumentPluginBase::encodeValidatorId($this->definition['id']); $form['restrict_roles'] = array('#type' => 'checkbox', '#title' => $this->t('Restrict user based on role'), '#default_value' => $this->options['restrict_roles']); $form['roles'] = array('#type' => 'checkboxes', '#title' => $this->t('Restrict to the selected roles'), '#options' => array_map(array('\\Drupal\\Component\\Utility\\SafeMarkup', 'checkPlain'), user_role_names(TRUE)), '#default_value' => $this->options['roles'], '#description' => $this->t('If no roles are selected, users from any role will be allowed.'), '#states' => array('visible' => array(':input[name="options[validate][options][' . $sanitized_id . '][restrict_roles]"]' => array('checked' => TRUE)))); }
/** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['transform'] = array( '#type' => 'checkbox', '#title' => $this->t('Transform dashes in URL to underscores in term name filter values'), '#default_value' => $this->options['transform'], ); }
/** * {@inheritdoc} */ public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); $form['restrict_roles'] = array('#type' => 'checkbox', '#title' => $this->t('Restrict user based on role'), '#default_value' => $this->options['restrict_roles']); $form['roles'] = array('#type' => 'checkboxes', '#title' => $this->t('Restrict to the selected roles'), '#options' => array_map(array('\\Drupal\\Component\\Utility\\String', 'checkPlain'), user_role_names(TRUE)), '#default_value' => $this->options['roles'], '#description' => $this->t('If no roles are selected, users from any role will be allowed.'), '#states' => array('visible' => array(':input[name="options[validate][options][user][restrict_roles]"]' => array('checked' => TRUE)))); }