Commit 116f0a38 authored by alexpott's avatar alexpott

Issue #2003366 by sillygwailo, Joe9, kenianbei, pcambra, heddn, YesCT,...

Issue #2003366 by sillygwailo, Joe9, kenianbei, pcambra, heddn, YesCT, damiankloip: Rename Views method pre_render() to preRender().
parent 2bb2976a
...@@ -91,7 +91,7 @@ public function query() { ...@@ -91,7 +91,7 @@ public function query() {
$this->field_alias = $this->table . '_' . $this->field; $this->field_alias = $this->table . '_' . $this->field;
} }
function pre_render(&$values) { public function preRender(&$values) {
global $user; global $user;
if (!$user->uid || empty($values)) { if (!$user->uid || empty($values)) {
return; return;
......
...@@ -54,7 +54,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -54,7 +54,7 @@ public function buildOptionsForm(&$form, &$form_state) {
); );
} }
function pre_render($result) { public function preRender($result) {
$cids = array(); $cids = array();
$nids = array(); $nids = array();
......
...@@ -51,7 +51,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -51,7 +51,7 @@ public function buildOptionsForm(&$form, &$form_state) {
); );
} }
function pre_render(&$values) { public function preRender(&$values) {
// Add a row plugin css class for the contextual link. // Add a row plugin css class for the contextual link.
$class = 'contextual-region'; $class = 'contextual-region';
if (!empty($this->view->style_plugin->options['row_class'])) { if (!empty($this->view->style_plugin->options['row_class'])) {
......
...@@ -47,15 +47,15 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -47,15 +47,15 @@ public function buildOptionsForm(&$form, &$form_state) {
} }
/** /**
* Overrides \Drupal\views\Plugin\views\row\Fields::pre_render(). * {@inheritdoc}
*/ */
public function pre_render($row) { public function preRender($row) {
// Force all fields to be inline by default. // Force all fields to be inline by default.
if (empty($this->options['inline'])) { if (empty($this->options['inline'])) {
$fields = $this->view->getItems('field', $this->displayHandler->display['id']); $fields = $this->view->getItems('field', $this->displayHandler->display['id']);
$this->options['inline'] = drupal_map_assoc(array_keys($fields)); $this->options['inline'] = drupal_map_assoc(array_keys($fields));
} }
return parent::pre_render($row); return parent::preRender($row);
} }
} }
...@@ -32,7 +32,7 @@ class Rss extends RowPluginBase { ...@@ -32,7 +32,7 @@ class Rss extends RowPluginBase {
var $base_field = 'nid'; var $base_field = 'nid';
// Stores the nodes loaded with pre_render. // Stores the nodes loaded with preRender.
var $nodes = array(); var $nodes = array();
protected function defineOptions() { protected function defineOptions() {
...@@ -79,7 +79,7 @@ public function summaryTitle() { ...@@ -79,7 +79,7 @@ public function summaryTitle() {
return check_plain($options[$this->options['item_length']]); return check_plain($options[$this->options['item_length']]);
} }
function pre_render($values) { public function preRender($values) {
$nids = array(); $nids = array();
foreach ($values as $row) { foreach ($values as $row) {
$nids[] = $row->{$this->field_alias}; $nids[] = $row->{$this->field_alias};
......
...@@ -57,10 +57,10 @@ public function render($values) { ...@@ -57,10 +57,10 @@ public function render($values) {
} }
/** /**
* Overrides \Drupal\views\Plugin\views\Plugin\field\FieldPluginBase::pre_render(). * {@inheritdoc}
*/ */
public function pre_render(&$values) { public function preRender(&$values) {
parent::pre_render($values); parent::preRender($values);
// If the view is using a table style, provide a placeholder for a // If the view is using a table style, provide a placeholder for a
// "select all" checkbox. // "select all" checkbox.
......
...@@ -91,7 +91,7 @@ public function query() { ...@@ -91,7 +91,7 @@ public function query() {
$this->addAdditionalFields(); $this->addAdditionalFields();
} }
function pre_render(&$values) { public function preRender(&$values) {
$vocabularies = entity_load_multiple('taxonomy_vocabulary'); $vocabularies = entity_load_multiple('taxonomy_vocabulary');
$this->field_alias = $this->aliases['nid']; $this->field_alias = $this->aliases['nid'];
$nids = array(); $nids = array();
......
...@@ -69,7 +69,7 @@ public function query() { ...@@ -69,7 +69,7 @@ public function query() {
$this->field_alias = $this->aliases['uid']; $this->field_alias = $this->aliases['uid'];
} }
function pre_render(&$values) { public function preRender(&$values) {
$uids = array(); $uids = array();
$this->items = array(); $this->items = array();
......
...@@ -69,7 +69,7 @@ public function query() { ...@@ -69,7 +69,7 @@ public function query() {
$this->field_alias = $this->aliases['uid']; $this->field_alias = $this->aliases['uid'];
} }
function pre_render(&$values) { public function preRender(&$values) {
$uids = array(); $uids = array();
$this->items = array(); $this->items = array();
......
...@@ -49,8 +49,8 @@ public function testRole() { ...@@ -49,8 +49,8 @@ public function testRole() {
$view = views_get_view('test_views_handler_field_role'); $view = views_get_view('test_views_handler_field_role');
$this->executeView($view); $this->executeView($view);
$view->row_index = 0; $view->row_index = 0;
// The role field is populated during pre_render. // The role field is populated during preRender.
$view->field['rid']->pre_render($view->result); $view->field['rid']->preRender($view->result);
$render = $view->field['rid']->advancedRender($view->result[0]); $render = $view->field['rid']->advancedRender($view->result[0]);
$this->assertEqual($rolename_b . $rolename_a, $render, 'View test_views_handler_field_role renders role assigned to user in the correct order.'); $this->assertEqual($rolename_b . $rolename_a, $render, 'View test_views_handler_field_role renders role assigned to user in the correct order.');
......
...@@ -274,7 +274,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -274,7 +274,7 @@ public function buildOptionsForm(&$form, &$form_state) {
// Some form elements belong in a fieldset for presentation, but can't // Some form elements belong in a fieldset for presentation, but can't
// be moved into one because of the form_state['values'] hierarchy. Those // be moved into one because of the form_state['values'] hierarchy. Those
// elements can add a #fieldset => 'fieldset_name' property, and they'll // elements can add a #fieldset => 'fieldset_name' property, and they'll
// be moved to their fieldset during pre_render. // be moved to their fieldset during preRender.
$form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup'; $form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup';
$form['admin_label'] = array( $form['admin_label'] = array(
......
...@@ -184,7 +184,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -184,7 +184,7 @@ public function buildOptionsForm(&$form, &$form_state) {
// Some form elements belong in a fieldset for presentation, but can't // Some form elements belong in a fieldset for presentation, but can't
// be moved into one because of the form_state['values'] hierarchy. Those // be moved into one because of the form_state['values'] hierarchy. Those
// elements can add a #fieldset => 'fieldset_name' property, and they'll // elements can add a #fieldset => 'fieldset_name' property, and they'll
// be moved to their fieldset during pre_render. // be moved to their fieldset during preRender.
$form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup'; $form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup';
} }
......
...@@ -173,7 +173,7 @@ public function query() { ...@@ -173,7 +173,7 @@ public function query() {
} }
} }
function pre_render($values) { } public function preRender($values) { }
public function postRender(&$output) { } public function postRender(&$output) { }
......
...@@ -71,7 +71,7 @@ protected function exposedFilterApplied() { ...@@ -71,7 +71,7 @@ protected function exposedFilterApplied() {
return $cache; return $cache;
} }
function pre_render($values) { public function preRender($values) {
if (!$this->exposedFilterApplied()) { if (!$this->exposedFilterApplied()) {
$options = array( $options = array(
'id' => 'area', 'id' => 'area',
......
...@@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -38,7 +38,7 @@ public function buildOptionsForm(&$form, &$form_state) {
unset($form['alter']['alter_text']); unset($form['alter']['alter_text']);
unset($form['alter']['text']['#states']); unset($form['alter']['text']['#states']);
unset($form['alter']['help']['#states']); unset($form['alter']['help']['#states']);
$form['#pre_render'][] = array($this, 'preRender'); $form['#pre_render'][] = array($this, 'preRenderCustomForm');
} }
function render($values) { function render($values) {
...@@ -55,7 +55,7 @@ function render($values) { ...@@ -55,7 +55,7 @@ function render($values) {
* @return array * @return array
* The modified form build array. * The modified form build array.
*/ */
public function preRender($form) { public function preRenderCustomForm($form) {
$form['text'] = $form['alter']['text']; $form['text'] = $form['alter']['text'];
$form['help'] = $form['alter']['help']; $form['help'] = $form['alter']['help'];
unset($form['alter']['text']); unset($form['alter']['text']);
......
...@@ -1090,7 +1090,7 @@ public function adminSummary() { ...@@ -1090,7 +1090,7 @@ public function adminSummary() {
* @param $values * @param $values
* An array of all objects returned from the query. * An array of all objects returned from the query.
*/ */
function pre_render(&$values) { } public function preRender(&$values) { }
/** /**
* Render the field. * Render the field.
......
...@@ -62,7 +62,7 @@ public function buildOptionsForm(&$form, &$form_state) { ...@@ -62,7 +62,7 @@ public function buildOptionsForm(&$form, &$form_state) {
); );
} }
function pre_render(&$values) { public function preRender(&$values) {
$this->getValueOptions(); $this->getValueOptions();
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
/** /**
* Field handler to provide a list of items. * Field handler to provide a list of items.
* *
* The items are expected to be loaded by a child object during pre_render, * The items are expected to be loaded by a child object during preRender,
* and 'my field' is expected to be the pointer to the items in the list. * and 'my field' is expected to be the pointer to the items in the list.
* *
* Items to render should be in a list in $this->items * Items to render should be in a list in $this->items
......
...@@ -493,8 +493,8 @@ public function showExposeButton(&$form, &$form_state) { ...@@ -493,8 +493,8 @@ public function showExposeButton(&$form, &$form_state) {
public function buildExposeForm(&$form, &$form_state) { public function buildExposeForm(&$form, &$form_state) {
$form['#theme'] = 'views_ui_expose_filter_form'; $form['#theme'] = 'views_ui_expose_filter_form';
// #flatten will move everything from $form['expose'][$key] to $form[$key] // #flatten will move everything from $form['expose'][$key] to $form[$key]
// prior to rendering. That's why the pre_render for it needs to run first, // prior to rendering. That's why the preRender for it needs to run first,
// so that when the next pre_render (the one for fieldsets) runs, it gets // so that when the next preRender (the one for fieldsets) runs, it gets
// the flattened data. // the flattened data.
array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data'); array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data');
$form['expose']['#flatten'] = TRUE; $form['expose']['#flatten'] = TRUE;
...@@ -836,8 +836,8 @@ protected function buildExposedFiltersGroupForm(&$form, &$form_state) { ...@@ -836,8 +836,8 @@ protected function buildExposedFiltersGroupForm(&$form, &$form_state) {
$form['#theme'] = 'views_ui_build_group_filter_form'; $form['#theme'] = 'views_ui_build_group_filter_form';
// #flatten will move everything from $form['group_info'][$key] to $form[$key] // #flatten will move everything from $form['group_info'][$key] to $form[$key]
// prior to rendering. That's why the pre_render for it needs to run first, // prior to rendering. That's why the preRender for it needs to run first,
// so that when the next pre_render (the one for fieldsets) runs, it gets // so that when the next preRender (the one for fieldsets) runs, it gets
// the flattened data. // the flattened data.
array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data'); array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data');
$form['group_info']['#flatten'] = TRUE; $form['group_info']['#flatten'] = TRUE;
......
...@@ -215,7 +215,7 @@ public function postExecute(&$result) { } ...@@ -215,7 +215,7 @@ public function postExecute(&$result) { }
/** /**
* Perform any needed actions just before rendering. * Perform any needed actions just before rendering.
*/ */
function pre_render(&$result) { } public function preRender(&$result) { }
/** /**
* Render the pager. * Render the pager.
......
...@@ -142,10 +142,10 @@ public function summaryTitle() { ...@@ -142,10 +142,10 @@ public function summaryTitle() {
} }
/** /**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::pre_render(). * {@inheritdoc}
*/ */
public function pre_render($result) { public function preRender($result) {
parent::pre_render($result); parent::preRender($result);
if ($result) { if ($result) {
// Get all entities which will be used to render in rows. // Get all entities which will be used to render in rows.
......
...@@ -135,7 +135,7 @@ public function query() { ...@@ -135,7 +135,7 @@ public function query() {
* @param $result * @param $result
* The full array of results from the query. * The full array of results from the query.
*/ */
function pre_render($result) { } public function preRender($result) { }
/** /**
* Render a row object. This usually passes through to a theme template * Render a row object. This usually passes through to a theme template
......
...@@ -188,8 +188,8 @@ protected function sortOptions() { ...@@ -188,8 +188,8 @@ protected function sortOptions() {
public function buildExposeForm(&$form, &$form_state) { public function buildExposeForm(&$form, &$form_state) {
// #flatten will move everything from $form['expose'][$key] to $form[$key] // #flatten will move everything from $form['expose'][$key] to $form[$key]
// prior to rendering. That's why the pre_render for it needs to run first, // prior to rendering. That's why the preRender for it needs to run first,
// so that when the next pre_render (the one for fieldsets) runs, it gets // so that when the next preRender (the one for fieldsets) runs, it gets
// the flattened data. // the flattened data.
array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data'); array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data');
$form['expose']['#flatten'] = TRUE; $form['expose']['#flatten'] = TRUE;
......
...@@ -399,9 +399,9 @@ public function buildSortPost() { } ...@@ -399,9 +399,9 @@ public function buildSortPost() { }
* @param $result * @param $result
* The full array of results from the query. * The full array of results from the query.
*/ */
function pre_render($result) { public function preRender($result) {
if (!empty($this->view->rowPlugin)) { if (!empty($this->view->rowPlugin)) {
$this->view->rowPlugin->pre_render($result); $this->view->rowPlugin->preRender($result);
} }
} }
......
...@@ -1227,7 +1227,7 @@ public function render($display_id = NULL) { ...@@ -1227,7 +1227,7 @@ public function render($display_id = NULL) {
$config = config('views.settings'); $config = config('views.settings');
$exposed_form = $this->display_handler->getPlugin('exposed_form'); $exposed_form = $this->display_handler->getPlugin('exposed_form');
$exposed_form->pre_render($this->result); $exposed_form->preRender($this->result);
$module_handler = \Drupal::moduleHandler(); $module_handler = \Drupal::moduleHandler();
...@@ -1246,9 +1246,9 @@ public function render($display_id = NULL) { ...@@ -1246,9 +1246,9 @@ public function render($display_id = NULL) {
$cache->cacheStart(); $cache->cacheStart();
} }
// Run pre_render for the pager as it might change the result. // Run preRender for the pager as it might change the result.
if (!empty($this->pager)) { if (!empty($this->pager)) {
$this->pager->pre_render($this->result); $this->pager->preRender($this->result);
} }
// Initialize the style plugin. // Initialize the style plugin.
...@@ -1264,12 +1264,12 @@ public function render($display_id = NULL) { ...@@ -1264,12 +1264,12 @@ public function render($display_id = NULL) {
if ($this->style_plugin->usesFields()) { if ($this->style_plugin->usesFields()) {
foreach ($this->field as $id => $handler) { foreach ($this->field as $id => $handler) {
if (!empty($this->field[$id])) { if (!empty($this->field[$id])) {
$this->field[$id]->pre_render($this->result); $this->field[$id]->preRender($this->result);
} }
} }
} }
$this->style_plugin->pre_render($this->result); $this->style_plugin->preRender($this->result);
// Let each area handler have access to the result set. // Let each area handler have access to the result set.
$areas = array('header', 'footer'); $areas = array('header', 'footer');
......
...@@ -431,7 +431,7 @@ function hook_views_pre_execute(ViewExecutable &$view) { ...@@ -431,7 +431,7 @@ function hook_views_pre_execute(ViewExecutable &$view) {
/** /**
* Act on the view immediately after the query has been executed. * Act on the view immediately after the query has been executed.
* *
* At this point the query has been executed, but the pre_render() phase has * At this point the query has been executed, but the preRender() phase has
* not yet happened for handlers. * not yet happened for handlers.
* *
* Output can be added to the view by setting $view->attachment_before * Output can be added to the view by setting $view->attachment_before
...@@ -455,7 +455,7 @@ function hook_views_post_execute(ViewExecutable &$view) { ...@@ -455,7 +455,7 @@ function hook_views_post_execute(ViewExecutable &$view) {
/** /**
* Act on the view immediately before rendering it. * Act on the view immediately before rendering it.
* *
* At this point the query has been executed, and the pre_render() phase has * At this point the query has been executed, and the preRender() phase has
* already happened for handlers, so all data should be available. This hook * already happened for handlers, so all data should be available. This hook
* can be utilized by themes. * can be utilized by themes.
* *
......
...@@ -258,7 +258,7 @@ function views_ui_taxonomy_autocomplete_validate($element, &$form_state) { ...@@ -258,7 +258,7 @@ function views_ui_taxonomy_autocomplete_validate($element, &$form_state) {
* *
* Many views forms use #tree = TRUE to keep their values in a hierarchy for * Many views forms use #tree = TRUE to keep their values in a hierarchy for
* easier storage. Moving the form elements into fieldsets during form building * easier storage. Moving the form elements into fieldsets during form building
* would break up that hierarchy. Therefore, we wait until the pre_render stage, * would break up that hierarchy. Therefore, we wait until the preRender stage,
* where any changes we make affect presentation only and aren't reflected in * where any changes we make affect presentation only and aren't reflected in
* $form_state['values']. * $form_state['values'].
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment