You are here

public function Name::buildOptionsForm in Views (for Drupal 7) 8.3

Provide link to node option

Overrides User::buildOptionsForm

File

lib/Views/user/Plugin/views/field/Name.php, line 46
Definition of Views\user\Plugin\views\field\Name.

Class

Name
Field handler to provide simple renderer that allows using a themed user link.

Namespace

Views\user\Plugin\views\field

Code

public function 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.'),
    '#fieldset' => 'more',
  );
  $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.'),
    '#fieldset' => 'more',
  );
  $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,
        ),
      ),
    ),
    '#fieldset' => 'more',
  );
  parent::buildOptionsForm($form, $form_state);
}