Newer
Older
<?php
/**
* @file
* Contains \Drupal\views_test_data\Plugin\views\area\TestExample.
*/
namespace Drupal\views_test_data\Plugin\views\area;
Dries Buytaert
committed
use Drupal\Core\Form\FormStateInterface;
Alex Pott
committed
use Drupal\Core\Session\AccountInterface;
use Drupal\views\Plugin\views\area\AreaPluginBase;
/**
* Test area plugin.
*
Alex Pott
committed
* @see \Drupal\views\Tests\Handler\AreaTest
* @ViewsArea("test_example")
*/
class TestExample extends AreaPluginBase {
Alex Pott
committed
/**
* {@inheritdoc}
*/
public function access(AccountInterface $account) {
return $this->options['custom_access'];
}
/**
* {@inheritdoc}
*/
public function defineOptions() {
$options = parent::defineOptions();
$options['string'] = array('default' => '');
Alex Pott
committed
$options['custom_access'] = array('default' => TRUE);
return $options;
}
Angie Byron
committed
/**
* {@inheritdoc}
Angie Byron
committed
*/
Dries Buytaert
committed
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
Angie Byron
committed
parent::buildOptionsForm($form, $form_state);
$this->globalTokenForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function render($empty = FALSE) {
Damian Lee
committed
if (!$empty || !empty($this->options['empty'])) {
return array(
'#markup' => $this->globalTokenReplace($this->options['string']),
);
Damian Lee
committed
}
return array();