diff --git a/core/modules/views/config/schema/views.area.schema.yml b/core/modules/views/config/schema/views.area.schema.yml index b75deb1..255be47 100644 --- a/core/modules/views/config/schema/views.area.schema.yml +++ b/core/modules/views/config/schema/views.area.schema.yml @@ -26,11 +26,8 @@ views.area.text: label: 'Text' mapping: content: - type: text - label: 'The shown text of the area' - format: - type: string - label: 'The filter format the content is in' + type: text_format + label: 'The formatted text of the area' tokenize: type: boolean label: 'Should replacement tokens be used from the first row' diff --git a/core/modules/views/src/Plugin/views/area/Text.php b/core/modules/views/src/Plugin/views/area/Text.php index 29da4bc..d8209bd 100644 --- a/core/modules/views/src/Plugin/views/area/Text.php +++ b/core/modules/views/src/Plugin/views/area/Text.php @@ -23,7 +23,12 @@ class Text extends TokenizeAreaPluginBase { */ protected function defineOptions() { $options = parent::defineOptions(); - $options['content'] = array('default' => '', 'format_key' => 'format'); + $options['content'] = array( + 'contains' => array( + 'value' => array('default' => ''), + 'format' => array('default' => NULL), + ), + ); $options['format'] = array('default' => NULL); return $options; } @@ -37,9 +42,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['content'] = array( '#title' => $this->t('Content'), '#type' => 'text_format', - '#default_value' => $this->options['content'], + '#default_value' => $this->options['content']['value'], '#rows' => 6, - '#format' => isset($this->options['format']) ? $this->options['format'] : filter_default_format(), + '#format' => isset($this->options['content']['format']) ? $this->options['content']['format'] : filter_default_format(), '#editor' => FALSE, ); } @@ -47,22 +52,12 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { /** * {@inheritdoc} */ - public function submitOptionsForm(&$form, FormStateInterface $form_state) { - $content = $form_state->getValue(array('options', 'content')); - $form_state->setValue(array('options', 'format'), $content['format']); - $form_state->setValue(array('options', 'content'), $content['value']); - parent::submitOptionsForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ public function render($empty = FALSE) { - $format = isset($this->options['format']) ? $this->options['format'] : filter_default_format(); + $format = isset($this->options['content']['format']) ? $this->options['content']['format'] : filter_default_format(); if (!$empty || !empty($this->options['empty'])) { return array( '#type' => 'processed_text', - '#text' => $this->tokenizeValue($this->options['content']), + '#text' => $this->tokenizeValue($this->options['content']['value']), '#format' => $format, ); }