diff --git a/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml b/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml index 6cea289..dea2bba 100644 --- a/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml +++ b/core/modules/action/tests/action_bulk_test/config/install/views.view.test_bulk_form.yml @@ -173,7 +173,7 @@ display: area: id: area table: views - field: area + field: area_text_custom empty: true content: 'This view is empty.' plugin_id: text_custom diff --git a/core/modules/node/config/install/views.view.frontpage.yml b/core/modules/node/config/install/views.view.frontpage.yml index 503a5e0..118c587 100644 --- a/core/modules/node/config/install/views.view.frontpage.yml +++ b/core/modules/node/config/install/views.view.frontpage.yml @@ -34,7 +34,7 @@ display: relationship: none table: views tokenize: false - plugin_id: text + plugin_id: text_custom node_listing_empty: admin_label: '' empty: true diff --git a/core/modules/text/config/schema/text.data_types.schema.yml b/core/modules/text/config/schema/text.data_types.schema.yml new file mode 100644 index 0000000..e69de29 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..a8d9555 100644 --- a/core/modules/views/src/Plugin/views/area/Text.php +++ b/core/modules/views/src/Plugin/views/area/Text.php @@ -23,8 +23,12 @@ class Text extends TokenizeAreaPluginBase { */ protected function defineOptions() { $options = parent::defineOptions(); - $options['content'] = array('default' => '', 'format_key' => 'format'); - $options['format'] = array('default' => NULL); + $options['content'] = array( + 'contains' => array( + 'value' => array('default' => ''), + 'format' => array('default' => NULL), + ), + ); return $options; } @@ -37,9 +41,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 +51,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, ); } diff --git a/core/modules/views/src/Tests/Handler/AreaTextTest.php b/core/modules/views/src/Tests/Handler/AreaTextTest.php index d0eaf14..5387a6e 100644 --- a/core/modules/views/src/Tests/Handler/AreaTextTest.php +++ b/core/modules/views/src/Tests/Handler/AreaTextTest.php @@ -45,18 +45,20 @@ public function testAreaText() { 'id' => 'area', 'table' => 'views', 'field' => 'area', - 'content' => $string, + 'content' => array( + 'value' => $string, + ), ), )); // Execute the view. $this->executeView($view); - $view->display_handler->handlers['header']['area']->options['format'] = $this->randomString(); + $view->display_handler->handlers['header']['area']->options['content']['format'] = $this->randomString(); $build = $view->display_handler->handlers['header']['area']->render(); $this->assertEqual('', drupal_render($build), 'Nonexistent format should return empty markup.'); - $view->display_handler->handlers['header']['area']->options['format'] = filter_default_format(); + $view->display_handler->handlers['header']['area']->options['content']['format'] = filter_default_format(); $build = $view->display_handler->handlers['header']['area']->render(); $this->assertEqual(check_markup($string), drupal_render($build), 'Existent format should return something');