class DisplayTest in Views (for Drupal 7) 8.3
Same name in this branch
- 8.3 lib/Drupal/views/Tests/Plugin/DisplayTest.php \Drupal\views\Tests\Plugin\DisplayTest
- 8.3 lib/Drupal/views/Tests/UI/DisplayTest.php \Drupal\views\Tests\UI\DisplayTest
- 8.3 tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/display/DisplayTest.php \Drupal\views_test_data\Plugin\views\display\DisplayTest
Defines a Display test plugin.
Plugin annotation
@Plugin(
id = "display_test",
title = @Translation("Display test"),
theme = "views_view",
contextual_links_locations = {"view"}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\display\DisplayPluginBase
- class \Drupal\views_test_data\Plugin\views\display\DisplayTest
- class \Drupal\views\Plugin\views\display\DisplayPluginBase
- class \Drupal\views\Plugin\views\PluginBase
Expanded class hierarchy of DisplayTest
1 file declares its use of DisplayTest
- DisplayTest.php in lib/
Drupal/ views/ Tests/ Plugin/ DisplayTest.php - Definition of Drupal\views\Tests\Plugin\DisplayTest.
File
- tests/
views_test_data/ lib/ Drupal/ views_test_data/ Plugin/ views/ display/ DisplayTest.php, line 24 - Definition of Drupal\views_test_data\Plugin\views\display\DisplayTest.
Namespace
Drupal\views_test_data\Plugin\views\displayView source
class DisplayTest extends DisplayPluginBase {
/**
* Whether the display allows attachments.
*
* @var bool
*/
protected $usesAttachments = TRUE;
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::defineOptions().
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['test_option'] = array(
'default' => '',
);
return $options;
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummaryv().
*/
public function optionsSummary(&$categories, &$options) {
parent::optionsSummary($categories, $options);
$categories['display_test'] = array(
'title' => t('Display test settings'),
'column' => 'second',
'build' => array(
'#weight' => -100,
),
);
$test_option = $this
->getOption('test_option') ?: t('Empty');
$options['test_option'] = array(
'category' => 'display_test',
'title' => t('Test option'),
'value' => views_ui_truncate($test_option, 24),
);
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::buildOptionsForm().
*/
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
switch ($form_state['section']) {
case 'test_option':
$form['#title'] .= t('Test option');
$form['test_option'] = array(
'#type' => 'textfield',
'#description' => t('This is a textfield for test_option.'),
'#default_value' => $this
->getOption('test_option'),
);
break;
}
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm().
*/
public function validateOptionsForm(&$form, &$form_state) {
parent::validateOptionsForm($form, $form_state);
watchdog('views', $form_state['values']['test_option']);
switch ($form_state['section']) {
case 'test_option':
if (!trim($form_state['values']['test_option'])) {
form_error($form['test_option'], t('You cannot have an empty option.'));
}
break;
}
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::submitOptionsForm().
*/
public function submitOptionsForm(&$form, &$form_state) {
parent::submitOptionsForm($form, $form_state);
switch ($form_state['section']) {
case 'test_option':
$this
->setOption('test_option', $form_state['values']['test_option']);
break;
}
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::execute().
*/
public function execute() {
$this->view
->build();
// Render the test option as the title before the view output.
$render = '<h1>' . filter_xss_admin($this->options['test_option']) . '</h1>';
// And now render the view.
$render .= $this->view
->render();
return $render;
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::preview().
*
* Override so preview and execute are the same output.
*/
public function preview() {
return $this
->execute();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DisplayPluginBase:: |
property | Stores all available display extenders. | ||
DisplayPluginBase:: |
property | |||
DisplayPluginBase:: |
public | property | Stores the rendered output of the display. | |
DisplayPluginBase:: |
protected | property | An array of instantiated plugins used in this display. | |
DisplayPluginBase:: |
protected | property | Whether the display allows the use of AJAX or not. | 1 |
DisplayPluginBase:: |
protected | property | Whether the display allows the use of a 'more' link or not. | |
DisplayPluginBase:: |
protected | property |
Overrides Drupal\views\Plugin\Plugin::$usesOptions. Overrides PluginBase:: |
|
DisplayPluginBase:: |
protected | property | Whether the display allows the use of a pager or not. | 2 |
DisplayPluginBase:: |
property |
The top object of a view. Overrides PluginBase:: |
||
DisplayPluginBase:: |
public | function | Determines whether this display can use attachments. | |
DisplayPluginBase:: |
public | function | Determine if the user has access to this display of the view. | |
DisplayPluginBase:: |
public | function | Allow displays to attach to other views. | 2 |
DisplayPluginBase:: |
public | function | Static member function to list which sections are defaultable and what items each section contains. | 1 |
DisplayPluginBase:: |
public | function |
Clears a plugin. Overrides PluginBase:: |
|
DisplayPluginBase:: |
public | function | Determine if this display should display the exposed filters widgets, so the view will know whether or not to render them. | 1 |
DisplayPluginBase:: |
protected | function | Format a list of theme templates for output by the theme info helper. | |
DisplayPluginBase:: |
public | function | Returns to tokens for arguments. | |
DisplayPluginBase:: |
public | function | Provide some helpful text for the arguments. The result should contain of an array with | 1 |
DisplayPluginBase:: |
public | function | Retrieve a list of fields for the current display with the relationship associated if it exists. | |
DisplayPluginBase:: |
public | function | Get the handler object for a single handler. | |
DisplayPluginBase:: |
public | function | Get a full array of handlers for $type. This caches them. | |
DisplayPluginBase:: |
public | function | Check to see which display to use when creating links within a view using this display. | |
DisplayPluginBase:: |
public | function | Intelligently get an option either from this display or from the default display, if directed to do so. | |
DisplayPluginBase:: |
public | function | Provide some helpful text for pagers. | 1 |
DisplayPluginBase:: |
public | function | Return the base path to use for this display. | |
DisplayPluginBase:: |
public | function | Get the instance of a plugin, for example style or row. | |
DisplayPluginBase:: |
public | function | Provide the block system with any exposed widget blocks for this display. | |
DisplayPluginBase:: |
protected | function | Displays can require a certain type of style plugin. By default, they will be 'normal'. | 1 |
DisplayPluginBase:: |
public | function | ||
DisplayPluginBase:: |
public | function | Check to see if the display has a 'path' field. | 1 |
DisplayPluginBase:: |
public | function | If this display creates a block, implement one of these. | |
DisplayPluginBase:: |
public | function | If this display creates a page with a menu item, implement it here. | |
DisplayPluginBase:: |
public | function | 1 | |
DisplayPluginBase:: |
public | function | Whether the display is actually using AJAX or not. | |
DisplayPluginBase:: |
public | function | Determine if this display is the 'default' display which contains fallback settings | 1 |
DisplayPluginBase:: |
public | function | Determine if a given option is set to use the default display or the current display | |
DisplayPluginBase:: |
public | function | Whether the display is enabled. | |
DisplayPluginBase:: |
public | function | Check if the provided identifier is unique. | |
DisplayPluginBase:: |
public | function | Whether the display is using the 'more' link or not. | |
DisplayPluginBase:: |
public | function | Whether the display is using a pager or not. | |
DisplayPluginBase:: |
public | function | Because forms may be split up into sections, this provides an easy URL to exactly the right section. Don't override this. | |
DisplayPluginBase:: |
public | function | If override/revert was clicked, perform the proper toggle. | |
DisplayPluginBase:: |
public | function | Set an option and force it to be an override. | |
DisplayPluginBase:: |
public | function | Set up any variables on the view prior to execution. These are separated from execute because they are extremely common and unlikely to be overridden on an individual display. | |
DisplayPluginBase:: |
public | function |
Inject anything into the query that the display handler needs. Overrides PluginBase:: |
|
DisplayPluginBase:: |
public | function | Render this display. | 1 |
DisplayPluginBase:: |
public | function | ||
DisplayPluginBase:: |
public | function | ||
DisplayPluginBase:: |
public | function | Not all display plugins will support filtering | |
DisplayPluginBase:: |
public | function | Render the footer of the view. | |
DisplayPluginBase:: |
public | function | Render the header of the view. | |
DisplayPluginBase:: |
public | function | Render the 'more' link | |
DisplayPluginBase:: |
public | function | Not all display plugins will suppert pager rendering. | 1 |
DisplayPluginBase:: |
public | function | Intelligently set an option either from this display or from the default display, if directed to do so. | |
DisplayPluginBase:: |
public | function | Flip the override setting for the given section. | |
DisplayPluginBase:: |
public | function | Does the display have groupby enabled? | |
DisplayPluginBase:: |
public | function | Should the enabled display more link be shown when no more items? | |
DisplayPluginBase:: |
public | function | Does the display have custom link text? | |
DisplayPluginBase:: |
public | function | Whether the display allows the use of AJAX or not. | 1 |
DisplayPluginBase:: |
public | function | Returns whether the display can use attachments. | 4 |
DisplayPluginBase:: |
public | function | Check to see if the display needs a breadcrumb | 1 |
DisplayPluginBase:: |
public | function | Determine if this display uses exposed filters, so the view will know whether or not to build them. | 2 |
DisplayPluginBase:: |
public | function | Check to see if the display can put the exposed formin a block. | |
DisplayPluginBase:: |
public | function | Determine if the display's style uses fields. | |
DisplayPluginBase:: |
public | function | Check to see if the display has some need to link to another display. | 1 |
DisplayPluginBase:: |
public | function | Whether the display allows the use of a 'more' link or not. | |
DisplayPluginBase:: |
public | function | Whether the display allows the use of a pager or not. | 2 |
DisplayPluginBase:: |
public | function |
Make sure the display and all associated handlers are valid. Overrides PluginBase:: |
1 |
DisplayPluginBase:: |
public | function | Render any special blocks provided for this display. | |
DisplayTest:: |
protected | property |
Whether the display allows attachments. Overrides DisplayPluginBase:: |
|
DisplayTest:: |
public | function |
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::buildOptionsForm(). Overrides DisplayPluginBase:: |
|
DisplayTest:: |
protected | function |
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::defineOptions(). Overrides DisplayPluginBase:: |
|
DisplayTest:: |
public | function |
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::execute(). Overrides DisplayPluginBase:: |
|
DisplayTest:: |
public | function |
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummaryv(). Overrides DisplayPluginBase:: |
|
DisplayTest:: |
public | function |
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::preview(). Overrides DisplayPluginBase:: |
|
DisplayTest:: |
public | function |
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::submitOptionsForm(). Overrides DisplayPluginBase:: |
|
DisplayTest:: |
public | function |
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm(). Overrides DisplayPluginBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
public | property | Plugins's definition | |
PluginBase:: |
public | property | The display object this plugin is for. | |
PluginBase:: |
public | property | Options for this plugin will be held here. | |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
public | function | Provide a list of additional theme functions for the theme information page | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Return the human readable name of the display. | |
PluginBase:: |
protected | function | ||
PluginBase:: |
public | function | Returns the summary of the settings in the display. | 6 |
PluginBase:: |
public | function | Provide a full list of possible theme templates used by this style. | 1 |
PluginBase:: |
public | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | |
PluginBase:: |
public | function | Returns the usesOptions property. | 8 |
PluginBase:: |
public | function |
Constructs a Plugin object. Overrides PluginBase:: |
2 |