3 namespace Drupal\views\Plugin\views\area;
5 use Drupal\Core\Form\FormStateInterface;
8 * Views area text handler.
10 * @ingroup views_area_handlers
12 * @ViewsArea("text_custom")
14 class TextCustom extends TokenizeAreaPluginBase {
19 protected function defineOptions() {
20 $options = parent::defineOptions();
21 $options['content'] = ['default' => ''];
28 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
29 parent::buildOptionsForm($form, $form_state);
32 '#title' => $this->t('Content'),
33 '#type' => 'textarea',
34 '#default_value' => $this->options['content'],
42 public function render($empty = FALSE) {
43 if (!$empty || !empty($this->options['empty'])) {
45 '#markup' => $this->renderTextarea($this->options['content']),
53 * Render a text area with \Drupal\Component\Utility\Xss::filterAdmin().
55 public function renderTextarea($value) {
57 return $this->sanitizeValue($this->tokenizeValue($value), 'xss_admin');