class StaticTest
Same name in other branches
- 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php \Drupal\views_test_data\Plugin\views\access\StaticTest
- 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php \Drupal\views_test_data\Plugin\views\access\StaticTest
- 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php \Drupal\views_test_data\Plugin\views\access\StaticTest
Tests a static access plugin.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface
- class \Drupal\views\Plugin\views\access\AccessPluginBase extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views_test_data\Plugin\views\access\StaticTest extends \Drupal\views\Plugin\views\access\AccessPluginBase
- class \Drupal\views\Plugin\views\access\AccessPluginBase extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of StaticTest
6 string references to 'StaticTest'
- DisplayPageTest::testDependencies in core/
modules/ views/ tests/ src/ Kernel/ Plugin/ DisplayPageTest.php - Tests the calculated dependencies for various views using Page displays.
- StaticTest::calculateDependencies in core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ access/ StaticTest.php - ViewEntityDependenciesTest::testGetDependencies in core/
modules/ views/ tests/ src/ Kernel/ Entity/ ViewEntityDependenciesTest.php - Tests the getDependencies method.
- views.view.test_access_static.yml in core/
modules/ views/ tests/ modules/ views_test_data/ test_views/ views.view.test_access_static.yml - core/modules/views/tests/modules/views_test_data/test_views/views.view.test_access_static.yml
- views.view.test_page_display_route.yml in core/
modules/ views/ tests/ modules/ views_test_config/ test_views/ views.view.test_page_display_route.yml - core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_route.yml
File
-
core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ access/ StaticTest.php, line 16
Namespace
Drupal\views_test_data\Plugin\views\accessView source
class StaticTest extends AccessPluginBase {
protected function defineOptions() {
$options = parent::defineOptions();
$options['access'] = [
'default' => FALSE,
];
return $options;
}
/**
* {@inheritdoc}
*/
public function access(AccountInterface $account) {
return !empty($this->options['access']);
}
/**
* {@inheritdoc}
*/
public function alterRouteDefinition(Route $route) {
if (!empty($this->options['access'])) {
$route->setRequirement('_access', 'TRUE');
}
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
return [
'content' => [
'StaticTest',
],
];
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.