You are here

public function BrokenHandlerTrait::buildOptionsForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/BrokenHandlerTrait.php \Drupal\views\Plugin\views\BrokenHandlerTrait::buildOptionsForm()

Provides a form to edit options for this plugin.

See also

\Drupal\views\Plugin\views\PluginBase::defineOptions()

File

core/modules/views/src/Plugin/views/BrokenHandlerTrait.php, line 53

Class

BrokenHandlerTrait
A Trait for Views broken handlers.

Namespace

Drupal\views\Plugin\views

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $description_top = t('The handler for this item is broken or missing. The following details are available:');
  foreach ($this->definition['original_configuration'] as $key => $value) {
    if (is_scalar($value)) {
      $items[] = new FormattableMarkup('@key: @value', [
        '@key' => $key,
        '@value' => $value,
      ]);
    }
  }
  $description_bottom = t('Enabling the appropriate module may solve this issue. Otherwise, check to see if there is a module update available.');
  $form['description'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'js-form-item',
        'form-item',
        'description',
      ],
    ],
    'description_top' => [
      '#markup' => '<p>' . $description_top . '</p>',
    ],
    'detail_list' => [
      '#theme' => 'item_list',
      '#items' => $items,
    ],
    'description_bottom' => [
      '#markup' => '<p>' . $description_bottom . '</p>',
    ],
  ];
}