3 namespace Drupal\views\Plugin\views\area;
5 use Drupal\Core\Form\FormStateInterface;
8 * Views area text handler.
10 * @ingroup views_area_handlers
14 class Text extends TokenizeAreaPluginBase {
19 protected function defineOptions() {
20 $options = parent::defineOptions();
21 $options['content'] = [
23 'value' => ['default' => ''],
24 'format' => ['default' => NULL],
33 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
34 parent::buildOptionsForm($form, $form_state);
37 '#title' => $this->t('Content'),
38 '#type' => 'text_format',
39 '#default_value' => $this->options['content']['value'],
41 '#format' => isset($this->options['content']['format']) ? $this->options['content']['format'] : filter_default_format(),
49 public function preQuery() {
50 $content = $this->options['content']['value'];
51 // Check for tokens that require a total row count.
52 if (strpos($content, '[view:page-count]') !== FALSE || strpos($content, '[view:total-rows]') !== FALSE) {
53 $this->view->get_total_rows = TRUE;
60 public function render($empty = FALSE) {
61 $format = isset($this->options['content']['format']) ? $this->options['content']['format'] : filter_default_format();
62 if (!$empty || !empty($this->options['empty'])) {
64 '#type' => 'processed_text',
65 '#text' => $this->tokenizeValue($this->options['content']['value']),