3 namespace Drupal\views_test_data\Plugin\views\area;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\Core\Session\AccountInterface;
7 use Drupal\views\Plugin\views\area\AreaPluginBase;
12 * @see \Drupal\views\Tests\Handler\AreaTest
14 * @ViewsArea("test_example")
16 class TestExample extends AreaPluginBase {
21 public function access(AccountInterface $account) {
22 return $this->options['custom_access'];
28 public function defineOptions() {
29 $options = parent::defineOptions();
30 $options['string'] = ['default' => ''];
31 $options['custom_access'] = ['default' => TRUE];
39 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
40 parent::buildOptionsForm($form, $form_state);
41 $this->globalTokenForm($form, $form_state);
47 public function render($empty = FALSE) {
48 if (!$empty || !empty($this->options['empty'])) {
50 '#markup' => $this->globalTokenReplace($this->options['string']),