You are here

public function MaestroEngineUserWhoCompleted::buildOptionsForm in Maestro 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/field/MaestroEngineUserWhoCompleted.php \Drupal\maestro\Plugin\views\field\MaestroEngineUserWhoCompleted::buildOptionsForm()

Provide the options form.

Overrides FieldPluginBase::buildOptionsForm

File

src/Plugin/views/field/MaestroEngineUserWhoCompleted.php, line 41

Class

MaestroEngineUserWhoCompleted
Field handler to create a linkage to the user who completed a task.

Namespace

Drupal\maestro\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $options = [
    'name' => $this
      ->t('Username'),
    'uid' => $this
      ->t('The User ID'),
    'email' => $this
      ->t('Email Address'),
  ];
  $form['user_display_style'] = [
    '#title' => $this
      ->t('How to show the user who completed the task?'),
    '#type' => 'select',
    '#default_value' => isset($this->options['user_display_style']) ? $this->options['user_display_style'] : 'name',
    '#options' => $options,
  ];
  $form['link_to_user'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display as link to the user?'),
    '#description' => $this
      ->t('When checked, the output in the view will show a link to the user\'s profile.'),
    '#default_value' => isset($this->options['link_to_user']) ? $this->options['link_to_user'] : 0,
  ];
  parent::buildOptionsForm($form, $form_state);
}