Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['format_username'] = array('#title' => t('Use formatted username'), '#type' => 'checkbox', '#default_value' => !empty($this->options['format_username']), '#description' => t('If checked, the username will be formatted by the system. If unchecked, it will be displayed raw.'));
     $form['overwrite_anonymous'] = array('#title' => t('Overwrite the value to display for anonymous users'), '#type' => 'checkbox', '#default_value' => !empty($this->options['overwrite_anonymous']), '#description' => t('Enable to display different text for anonymous users.'));
     $form['anonymous_text'] = array('#title' => t('Text to display for anonymous users'), '#type' => 'textfield', '#default_value' => $this->options['anonymous_text'], '#states' => array('visible' => array(':input[name="options[overwrite_anonymous]"]' => array('checked' => TRUE))));
 }
Пример #2
0
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['link_to_user'] = array('#title' => $this->t('Link this field'), '#type' => 'radios', '#options' => array(0 => $this->t('No link'), 'user' => $this->t('To the user'), 'mailto' => $this->t("With a mailto:")), '#default_value' => $this->options['link_to_user']);
 }