Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BrokenHandlerTrait.php

function 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 52

Class

BrokenHandlerTrait
A Trait for Views broken handlers.

Namespace

Drupal\views\Plugin\views

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    $description_top = $this->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 = $this->t('Installing 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>',
        ],
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal