trait BrokenHandlerTrait in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/BrokenHandlerTrait.php \Drupal\views\Plugin\views\BrokenHandlerTrait
A Trait for Views broken handlers.
Hierarchy
- trait \Drupal\views\Plugin\views\BrokenHandlerTrait
6 files declare their use of BrokenHandlerTrait
- Broken.php in core/
modules/ views/ src/ Plugin/ views/ area/ Broken.php - Contains \Drupal\views\Plugin\views\area\Broken.
- Broken.php in core/
modules/ views/ src/ Plugin/ views/ relationship/ Broken.php - Contains \Drupal\views\Plugin\views\relationship\Broken.
- Broken.php in core/
modules/ views/ src/ Plugin/ views/ filter/ Broken.php - Contains \Drupal\views\Plugin\views\filter\Broken.
- Broken.php in core/
modules/ views/ src/ Plugin/ views/ sort/ Broken.php - Contains \Drupal\views\Plugin\views\sort\Broken.
- Broken.php in core/
modules/ views/ src/ Plugin/ views/ argument/ Broken.php - Contains \Drupal\views\Plugin\views\argument\Broken.
File
- core/
modules/ views/ src/ Plugin/ views/ BrokenHandlerTrait.php, line 16 - Contains \Drupal\views\Plugin\views\BrokenHandlerTrait.
Namespace
Drupal\views\Plugin\viewsView source
trait BrokenHandlerTrait {
/**
* Returns this handlers name in the UI.
*
* @see \Drupal\views\Plugin\views\PluginBase::defineOptions().
*/
public function adminLabel($short = FALSE) {
return t('Broken/missing handler');
}
/**
* The option definition for this handler.
*
* @see \Drupal\views\Plugin\views\PluginBase::defineOptions().
*/
public function defineOptions() {
return array();
}
/**
* Ensure the main table for this handler is in the query. This is used
* a lot.
*
* @see \Drupal\views\Plugin\views\HandlerBase::ensureMyTable().
*/
public function ensureMyTable() {
// No table to ensure.
}
/**
* Modify the views query.
*/
public function query($group_by = FALSE) {
/* No query to run */
}
/**
* Provides a form to edit options for this plugin.
*
* @see \Drupal\views\Plugin\views\PluginBase::defineOptions().
*/
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[] = SafeMarkup::format('@key: @value', array(
'@key' => $key,
'@value' => $value,
));
}
}
$description_bottom = t('Enabling the appropriate module will may solve this issue. Otherwise, check to see if there is a module update available.');
$form['description'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'js-form-item',
'form-item',
'description',
),
),
'description_top' => array(
'#markup' => '<p>' . $description_top . '</p>',
),
'detail_list' => array(
'#theme' => 'item_list',
'#items' => $items,
),
'description_bottom' => array(
'#markup' => '<p>' . $description_bottom . '</p>',
),
);
}
/**
* Determines if the handler is considered 'broken'.
*
* This means it's a placeholder used when a handler can't be found.
*
* @see \Drupal\views\Plugin\views\HandlerBase::broken().
*/
public function broken() {
return TRUE;
}
/**
* Gets dependencies for a broken handler.
*
* @return array
*
* @see \Drupal\views\Plugin\views\PluginBase::calculateDependencies().
*/
public function calculateDependencies() {
return [];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BrokenHandlerTrait:: |
public | function | Returns this handlers name in the UI. | |
BrokenHandlerTrait:: |
public | function | Determines if the handler is considered 'broken'. | |
BrokenHandlerTrait:: |
public | function | Provides a form to edit options for this plugin. | |
BrokenHandlerTrait:: |
public | function | Gets dependencies for a broken handler. | |
BrokenHandlerTrait:: |
public | function | The option definition for this handler. | |
BrokenHandlerTrait:: |
public | function | Ensure the main table for this handler is in the query. This is used a lot. | |
BrokenHandlerTrait:: |
public | function | Modify the views query. |