Same filename and directory in other branches
- 8.9.x core/modules/views/src/Plugin/views/BrokenHandlerTrait.php
- 9 core/modules/views/src/Plugin/views/BrokenHandlerTrait.php
Namespace
Drupal\views\Plugin\views
File
core/modules/views/src/Plugin/views/BrokenHandlerTrait.php
View source
<?php
namespace Drupal\views\Plugin\views;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Form\FormStateInterface;
trait BrokenHandlerTrait {
public function adminLabel($short = FALSE) {
return $this
->t('Broken/missing handler');
}
public function defineOptions() {
return [];
}
public function ensureMyTable() {
}
public function query($group_by = FALSE) {
}
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>',
],
];
}
public function broken() {
return TRUE;
}
public function calculateDependencies() {
return [];
}
}
Traits