You are here

public function EntityQueueSmartQueueArgument::buildOptionsForm in Entityqueue 8

Provide a form to edit options for this plugin.

Overrides StringArgument::buildOptionsForm

File

modules/entityqueue_smartqueue/src/Plugin/views/argument/EntityQueueSmartQueueArgument.php, line 66

Class

EntityQueueSmartQueueArgument
Plugin annotation @ViewsArgument("entityqueue_smartqueue_name");

Namespace

Drupal\entityqueue_smartqueue\Plugin\views\argument

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);

  // Add list of queues.
  $smartqueues = $this->entityTypeManager
    ->getStorage('entity_queue')
    ->loadByProperties([
    'handler' => 'smartqueue',
  ]);
  $options = [];
  foreach ($smartqueues as $queue) {
    $options[$queue
      ->id()] = $queue
      ->label();
  }
  $form['smartqueue'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Smartqueue ID'),
    '#default_value' => $this->options['smartqueue'],
    '#options' => $options,
  ];
}