From 9965220abdac30b239eddfe3f3994ae0b1cdd6fc Mon Sep 17 00:00:00 2001 From: Bojan Zivanovic Date: Tue, 28 Aug 2012 16:15:37 +0200 Subject: [PATCH] Issue #1760396 by bojanz: Clean up PrerenderList. --- .../Plugin/views/field/PrerenderList.php | 49 +------------------ .../user/Plugin/views/field/Permissions.php | 2 +- lib/Views/user/Plugin/views/field/Roles.php | 2 +- 3 files changed, 3 insertions(+), 50 deletions(-) diff --git a/lib/Drupal/views/Plugin/views/field/PrerenderList.php b/lib/Drupal/views/Plugin/views/field/PrerenderList.php index 3700d2909b..22ee4826dd 100644 --- a/lib/Drupal/views/Plugin/views/field/PrerenderList.php +++ b/lib/Drupal/views/Plugin/views/field/PrerenderList.php @@ -69,30 +69,6 @@ function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); } - /** - * Render the field. - * - * This function is deprecated, but left in for older systems that have not - * yet or won't update their prerender list fields. If a render_item method - * exists, this will not get used by advanced_render. - */ - function render($values) { - $field = $this->get_value($values); - if (!empty($this->items[$field])) { - if ($this->options['type'] == 'separator') { - return implode($this->sanitize_value($this->options['separator']), $this->items[$field]); - } - else { - return theme('item_list', - array( - 'items' => $this->items[$field], - 'title' => NULL, - 'type' => $this->options['type'] - )); - } - } - } - /** * Render all items in this field together. * @@ -126,8 +102,7 @@ function render_items($items) { * should also be in this array. */ function get_items($values) { - // Only the parent get_value returns a single field. - $field = parent::get_value($values); + $field = $this->get_value($values); if (!empty($this->items[$field])) { return $this->items[$field]; } @@ -135,28 +110,6 @@ function get_items($values) { return array(); } - /** - * Get the value that's supposed to be rendered. - * - * @param $values - * An object containing all retrieved values. - * @param $field - * Optional name of the field where the value is stored. - * @param $raw - * Use the raw data and not the data defined in pre_render - */ - function get_value($values, $field = NULL, $raw = FALSE) { - if ($raw) { - return parent::get_value($values, $field); - } - $item = $this->get_items($values); - $item = (array) $item; - if (isset($field) && isset($item[$field])) { - return $item[$field]; - } - return $item; - } - /** * Determine if advanced rendering is allowed. * diff --git a/lib/Views/user/Plugin/views/field/Permissions.php b/lib/Views/user/Plugin/views/field/Permissions.php index 2a9ab03463..1e36c892b3 100644 --- a/lib/Views/user/Plugin/views/field/Permissions.php +++ b/lib/Views/user/Plugin/views/field/Permissions.php @@ -37,7 +37,7 @@ function pre_render(&$values) { $this->items = array(); foreach ($values as $result) { - $uids[] = $this->get_value($result, NULL, TRUE); + $uids[] = $this->get_value($result); } if ($uids) { diff --git a/lib/Views/user/Plugin/views/field/Roles.php b/lib/Views/user/Plugin/views/field/Roles.php index 8d06958e21..2ab6bb6c64 100644 --- a/lib/Views/user/Plugin/views/field/Roles.php +++ b/lib/Views/user/Plugin/views/field/Roles.php @@ -37,7 +37,7 @@ function pre_render(&$values) { $this->items = array(); foreach ($values as $result) { - $uids[] = $this->get_value($result, NULL, TRUE); + $uids[] = $this->get_value($result); } if ($uids) { -- GitLab