diff --git a/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php b/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php index e6ce0ad..56585a5 100644 --- a/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php +++ b/core/modules/contextual/lib/Drupal/contextual/Plugin/views/field/ContextualLinks.php @@ -71,7 +71,8 @@ function pre_render(&$values) { function render($values) { $links = array(); foreach ($this->options['fields'] as $field) { - if (empty($this->view->style_plugin->rendered_fields[$this->view->row_index][$field])) { + $rendered_field = $this->view->style_plugin->get_field($this->view->row_index, $field); + if (empty($rendered_field)) { continue; } $title = $this->view->field[$field]->last_render_text; diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php index 59053c8..274ff1f 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/StylePluginBase.php @@ -80,6 +80,16 @@ protected $usesFields = FALSE; /** + * Stores the rendered field values, keyed by the row index and field name. + * + * @see \Drupal\views\Plugin\views\style\StylePluginBase::render_fields() + * @see \Drupal\views\Plugin\views\style\StylePluginBase::get_field() + * + * @var array|null + */ + protected $rendered_fields; + + /** * Initialize a style plugin. * * @param $view diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php index ce5599a..b9a6cba 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FieldCounterTest.php @@ -54,11 +54,11 @@ function testSimple() { )); $view->preview(); - $counter = $view->style_plugin->rendered_fields[0]['counter']; + $counter = $view->style_plugin->get_field(0, 'counter'); $this->assertEqual($counter, 1, format_string('Make sure the expected number (@expected) patches with the rendered number (@counter)', array('@expected' => 1, '@counter' => $counter))); - $counter = $view->style_plugin->rendered_fields[1]['counter']; + $counter = $view->style_plugin->get_field(1, 'counter'); $this->assertEqual($counter, 2, format_string('Make sure the expected number (@expected) patches with the rendered number (@counter)', array('@expected' => 2, '@counter' => $counter))); - $counter = $view->style_plugin->rendered_fields[2]['counter']; + $counter = $view->style_plugin->get_field(2, 'counter'); $this->assertEqual($counter, 3, format_string('Make sure the expected number (@expected) patches with the rendered number (@counter)', array('@expected' => 3, '@counter' => $counter))); $view->destroy(); @@ -81,13 +81,13 @@ function testSimple() { )); $view->preview(); - $counter = $view->style_plugin->rendered_fields[0]['counter']; + $counter = $view->style_plugin->get_field(0, 'counter'); $expected_number = 0 + $rand_start; $this->assertEqual($counter, $expected_number, format_string('Make sure the expected number (@expected) patches with the rendered number (@counter)', array('@expected' => $expected_number, '@counter' => $counter))); - $counter = $view->style_plugin->rendered_fields[1]['counter']; + $counter = $view->style_plugin->get_field(1, 'counter'); $expected_number = 1 + $rand_start; $this->assertEqual($counter, $expected_number, format_string('Make sure the expected number (@expected) patches with the rendered number (@counter)', array('@expected' => $expected_number, '@counter' => $counter))); - $counter = $view->style_plugin->rendered_fields[2]['counter']; + $counter = $view->style_plugin->get_field(2, 'counter'); $expected_number = 2 + $rand_start; $this->assertEqual($counter, $expected_number, format_string('Make sure the expected number (@expected) patches with the rendered number (@counter)', array('@expected' => $expected_number, '@counter' => $counter))); }