You are here

public function DiffPluginBase::viewsForm in Diff 8

1 call to DiffPluginBase::viewsForm()
DiffFrom::viewsForm in src/Plugin/views/field/DiffFrom.php
1 method overrides DiffPluginBase::viewsForm()
DiffFrom::viewsForm in src/Plugin/views/field/DiffFrom.php

File

src/Plugin/views/field/DiffPluginBase.php, line 77

Class

DiffPluginBase
Base class for diff view field plugins.

Namespace

Drupal\diff\Plugin\views\field

Code

public function viewsForm(array &$form, FormStateInterface $form_state) {
  if (!empty($this->view->result)) {
    $form[$this->options['id']]['#tree'] = TRUE;
    foreach ($this->view->result as $row_index => $row) {
      $entity = $row->_entity;
      $form[$this->options['id']][$row_index] = [
        '#type' => 'radio',
        '#parents' => [
          $this->options['id'],
        ],
        '#title' => $this
          ->t('Compare this item'),
        '#title_display' => 'invisible',
        '#return_value' => $this
          ->calculateEntityDiffFormKey($entity),
      ];
    }
  }
}