class DisplayExtenderTest
Same name and namespace in other branches
- 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest
- 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest
- 11.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest
Defines a display extender test plugin.
Plugin annotation
@ViewsDisplayExtender(
id = "display_extender_test",
title = @Translation("Display extender test")
)
Hierarchy
- class \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest
Expanded class hierarchy of DisplayExtenderTest
File
-
core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ display_extender/ DisplayExtenderTest.php, line 16
Namespace
Drupal\views_test_data\Plugin\views\display_extenderView source
class DisplayExtenderTest extends DisplayExtenderPluginBase {
/**
* Stores some state booleans to be sure a certain method got called.
*
* @var array
*/
public $testState;
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['test_extender_test_option'] = [
'default' => $this->t('Empty'),
];
return $options;
}
/**
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options) {
parent::optionsSummary($categories, $options);
$categories['display_extender_test'] = [
'title' => $this->t('Display extender test settings'),
'column' => 'second',
'build' => [
'#weight' => -100,
],
];
$options['test_extender_test_option'] = [
'category' => 'display_extender_test',
'title' => $this->t('Test option'),
'value' => views_ui_truncate($this->options['test_extender_test_option'], 24),
];
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
switch ($form_state->get('section')) {
case 'test_extender_test_option':
$form['#title'] .= $this->t('Test option');
$form['test_extender_test_option'] = [
'#title' => $this->t('Test option'),
'#type' => 'textfield',
'#description' => $this->t('This is a textfield for test_option.'),
'#default_value' => $this->options['test_extender_test_option'],
];
}
}
/**
* {@inheritdoc}
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
switch ($form_state->get('section')) {
case 'test_extender_test_option':
$this->options['test_extender_test_option'] = $form_state->getValue('test_extender_test_option');
break;
}
}
/**
* {@inheritdoc}
*/
public function defaultableSections(&$sections, $section = NULL) {
$sections['test_extender_test_option'] = [
'test_extender_test_option',
];
}
/**
* {@inheritdoc}
*/
public function query() {
$this->testState['query'] = TRUE;
}
/**
* {@inheritdoc}
*/
public function preExecute() {
$this->testState['preExecute'] = TRUE;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
DependencySerializationTrait::$_entityStorages | protected | property | An array of entity type IDs keyed by the property name of their storages. | ||
DependencySerializationTrait::$_serviceIds | protected | property | An array of service IDs keyed by property name used for serialization. | ||
DependencySerializationTrait::__sleep | public | function | 2 | ||
DependencySerializationTrait::__wakeup | public | function | #[\ReturnTypeWillChange] | 2 | |
DisplayExtenderTest::$testState | public | property | Stores some state booleans to be sure a certain method got called. | ||
DisplayExtenderTest::buildOptionsForm | public | function | Provide a form to edit options for this plugin. | ||
DisplayExtenderTest::defaultableSections | public | function | Gets a list of defaultable sections and the items they contain. | ||
DisplayExtenderTest::defineOptions | protected | function | Information about options for all kinds of purposes will be held here. | ||
DisplayExtenderTest::optionsSummary | public | function | Provide the default summary for options in the views UI. | ||
DisplayExtenderTest::preExecute | public | function | Set up any variables on the view prior to execution. | ||
DisplayExtenderTest::query | public | function | Inject anything into the query that the display_extender handler needs. | ||
DisplayExtenderTest::submitOptionsForm | public | function | Handle any special handling on the validate form. | ||
MessengerTrait::$messenger | protected | property | The messenger. | 27 | |
MessengerTrait::messenger | public | function | Gets the messenger. | 27 | |
MessengerTrait::setMessenger | public | function | Sets the messenger. | ||
PluginBase::$configuration | protected | property | Configuration information passed into the plugin. | 1 | |
PluginBase::$pluginDefinition | protected | property | The plugin implementation definition. | 1 | |
PluginBase::$pluginId | protected | property | The plugin_id. | ||
PluginBase::DERIVATIVE_SEPARATOR | constant | A string which is used to separate base plugin IDs from the derivative ID. | |||
PluginBase::getBaseId | public | function | Gets the base_plugin_id of the plugin instance. | Overrides DerivativeInspectionInterface::getBaseId | |
PluginBase::getDerivativeId | public | function | Gets the derivative_id of the plugin instance. | Overrides DerivativeInspectionInterface::getDerivativeId | |
PluginBase::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | Overrides PluginInspectionInterface::getPluginDefinition | 2 |
PluginBase::getPluginId | public | function | Gets the plugin_id of the plugin instance. | Overrides PluginInspectionInterface::getPluginId | |
PluginBase::isConfigurable | public | function | Determines if the plugin is configurable. | ||
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 | |
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | ||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | ||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | ||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | ||
TrustedCallbackInterface::THROW_EXCEPTION | constant | Untrusted callbacks throw exceptions. | |||
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION | constant | Untrusted callbacks trigger silenced E_USER_DEPRECATION errors. | |||
TrustedCallbackInterface::TRIGGER_WARNING | constant | Untrusted callbacks trigger E_USER_WARNING errors. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.