class TestExample in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/modules/views_test_data/src/Plugin/views/area/TestExample.php \Drupal\views_test_data\Plugin\views\area\TestExample
- 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/area/TestExample.php \Drupal\views_test_data\Plugin\views\area\TestExample
Test area plugin.
Plugin annotation
@ViewsArea("test_example");
Hierarchy
- class \Drupal\views\Plugin\views\area\AreaPluginBase extends \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views_test_data\Plugin\views\area\TestExample
Expanded class hierarchy of TestExample
See also
\Drupal\views\Tests\Handler\AreaTest
File
- core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ area/ TestExample.php, line 16
Namespace
Drupal\views_test_data\Plugin\views\areaView source
class TestExample extends AreaPluginBase {
/**
* {@inheritdoc}
*/
public function access(AccountInterface $account) {
return $this->options['custom_access'];
}
/**
* {@inheritdoc}
*/
public function defineOptions() {
$options = parent::defineOptions();
$options['string'] = [
'default' => '',
];
$options['custom_access'] = [
'default' => TRUE,
];
return $options;
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$this
->globalTokenForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function render($empty = FALSE) {
if (!$empty || !empty($this->options['empty'])) {
return [
'#markup' => $this
->globalTokenReplace($this->options['string']),
];
}
return [];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AreaPluginBase:: |
public | property | The type of this area handler, i.e. 'header', 'footer', or 'empty'. | |
AreaPluginBase:: |
public | function | ||
AreaPluginBase:: |
public | function | Overrides Drupal\views\Plugin\views\HandlerBase::init(). | 1 |
AreaPluginBase:: |
public | function | Does that area have nothing to show. | 1 |
AreaPluginBase:: |
public | function | Performs any operations needed before full rendering. | 1 |
AreaPluginBase:: |
public | function | ||
TestExample:: |
public | function | ||
TestExample:: |
public | function |
Overrides AreaPluginBase:: |
|
TestExample:: |
public | function |
Overrides AreaPluginBase:: |
|
TestExample:: |
public | function |
Render the area. Overrides AreaPluginBase:: |