Commit c29f2e2d authored by damiankloip's avatar damiankloip Committed by tim.plunkett

Issue #1762352 by aspilicious, dawehner, damiankloip: Clean up /camelCase methods on View.

parent b774fcbf
This diff is collapsed.
......@@ -66,7 +66,7 @@ public function setView(View $view = NULL) {
* 'warning' and 'error'.
*/
public function getMessages() {
$this->view->init_display();
$this->view->initDisplay();
$messages = module_invoke_all('views_analyze', $this->view);
return $messages;
......
......@@ -94,7 +94,7 @@ function init(&$view, &$options) {
$options['field'] = $this->actual_field;
}
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$plural = $this->plugin_type;
if (isset($types[$this->plugin_type]['plural'])) {
$plural = $types[$this->plugin_type]['plural'];
......@@ -179,7 +179,7 @@ function get_field($field = NULL) {
// If grouping, check to see if the aggregation method needs to modify the field.
if ($this->view->display_handler->use_group_by()) {
$this->view->init_query();
$this->view->initQuery();
if ($this->query) {
$info = $this->query->get_aggregation_info();
if (!empty($info[$this->options['group_type']]['method'])) {
......@@ -314,7 +314,7 @@ function use_group_by() {
function groupby_form(&$form, &$form_state) {
$view = &$form_state['view'];
$display_id = $form_state['display_id'];
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$type = $form_state['type'];
$id = $form_state['id'];
......@@ -323,7 +323,7 @@ function groupby_form(&$form, &$form_state) {
$form['#section'] = $display_id . '-' . $type . '-' . $id;
$view->init_query();
$view->initQuery();
$info = $view->query->get_aggregation_info();
foreach ($info as $id => $aggregate) {
$group_types[$id] = $aggregate['title'];
......
......@@ -131,7 +131,7 @@ function unpack_options(&$storage, $options, $definition = NULL, $all = TRUE, $c
if (!empty($this->view)) {
// Ensure we have a localization plugin.
$this->view->init_localization();
$this->view->initLocalization();
// Set up default localization keys. Handlers and such set this for us
if (empty($localization_keys) && isset($this->localization_keys)) {
......@@ -170,7 +170,7 @@ function unpack_options(&$storage, $options, $definition = NULL, $all = TRUE, $c
// Don't localize strings during editing. When editing, we need to work with
// the original data, not the translated version.
else if (empty($this->view->editing) && !empty($definition[$key]['translatable']) && !empty($value) || !empty($definition['contains'][$key]['translatable']) && !empty($value)) {
if (!empty($this->view) && $this->view->is_translatable()) {
if (!empty($this->view) && $this->view->isTranslatable()) {
// Allow other modules to make changes to the string before it's
// sent for translation.
// The $keys array is built from the view name, any localization keys
......
......@@ -67,8 +67,8 @@ function render($empty = FALSE) {
$output = '';
$format = $this->options['content'];
// Calculate the page totals.
$current_page = (int) $this->view->get_current_page() + 1;
$per_page = (int) $this->view->get_items_per_page();
$current_page = (int) $this->view->getCurrentPage() + 1;
$per_page = (int) $this->view->getItemsPerPage();
$count = count($this->view->result);
// @TODO: Maybe use a possible is views empty functionality.
// Not every view has total_rows set, use view->result instead.
......
......@@ -66,7 +66,7 @@ function render($empty = FALSE) {
if (empty($view) || !$view->access($display_id)) {
return;
}
$view->set_display($display_id);
$view->setDisplay($display_id);
// Avoid recursion
$view->parent_views += $this->view->parent_views;
......
......@@ -877,7 +877,7 @@ function summary_sort($order, $by = NULL) {
/**
* Provide the argument to use to link from the summary to the next level;
* this will be called once per row of a summary, and used as part of
* $view->get_url().
* $view->getUrl().
*
* @param $data
* The query results for the row.
......
......@@ -116,7 +116,7 @@ function cache_set($type) {
$data = array(
'result' => $this->view->result,
'total_rows' => isset($this->view->total_rows) ? $this->view->total_rows : 0,
'current_page' => $this->view->get_current_page(),
'current_page' => $this->view->getCurrentPage(),
);
cache($this->table)->set($this->get_results_key(), $data, $this->cache_set_expire($type));
break;
......@@ -147,7 +147,7 @@ function cache_get($type) {
if (!$cutoff || $cache->created > $cutoff) {
$this->view->result = $cache->data['result'];
$this->view->total_rows = $cache->data['total_rows'];
$this->view->set_current_page($cache->data['current_page']);
$this->view->setCurrentPage($cache->data['current_page']);
$this->view->execute_time = 0;
return TRUE;
}
......
......@@ -243,18 +243,18 @@ function attach_to($display_id) {
// Get a fresh view because our current one has a lot of stuff on it because it's
// already been executed.
$view = $this->view->clone_view();
$view = $this->view->cloneView();
$view->original_args = $view->args;
$args = $this->get_option('inherit_arguments') ? $this->view->args : array();
$view->set_arguments($args);
$view->set_display($this->display->id);
$view->setArguments($args);
$view->setDisplay($this->display->id);
if ($this->get_option('inherit_pager')) {
$view->display_handler->usesPager = $this->view->display[$display_id]->handler->usesPager();
$view->display_handler->set_option('pager', $this->view->display[$display_id]->handler->get_option('pager'));
}
$attachment = $view->execute_display($this->display->id, $args);
$attachment = $view->executeDisplay($this->display->id, $args);
switch ($this->get_option('attachment_position')) {
case 'before':
......
......@@ -54,10 +54,10 @@ function execute_hook_block_list($delta = 0, $edit = array()) {
if (empty($desc)) {
if ($this->display->display_title == $this->definition['title']) {
$desc = t('View: !view', array('!view' => $this->view->get_human_name()));
$desc = t('View: !view', array('!view' => $this->view->getHumanName()));
}
else {
$desc = t('View: !view: !display', array('!view' => $this->view->get_human_name(), '!display' => $this->display->display_title));
$desc = t('View: !view: !display', array('!view' => $this->view->getHumanName(), '!display' => $this->display->display_title));
}
}
return array(
......@@ -75,7 +75,7 @@ function execute() {
// Prior to this being called, the $view should already be set to this
// display, and arguments should be set on the view.
$info['content'] = $this->view->render();
$info['subject'] = filter_xss_admin($this->view->get_title());
$info['subject'] = filter_xss_admin($this->view->getTitle());
if (!empty($this->view->result) || $this->get_option('empty') || !empty($this->view->style_plugin->definition['even empty'])) {
return $info;
}
......@@ -171,7 +171,7 @@ function options_form(&$form, &$form_state) {
);
break;
case 'exposed_form_options':
$this->view->init_handlers();
$this->view->initHandlers();
if (!$this->uses_exposed() && parent::uses_exposed()) {
$form['exposed_form_options']['warning'] = array(
'#weight' => -10,
......
......@@ -43,14 +43,14 @@ function is_default_display() { return TRUE; }
*
* For the simplest use:
* @code
* $output = $view->execute_display('default', $args);
* $output = $view->executeDisplay('default', $args);
* @endcode
*
* For more complex usages, a view can be partially built:
* @code
* $view->set_arguments($args);
* $view->setArguments($args);
* $view->build('default'); // Build the query
* $view->pre_execute(); // Pre-execute the query.
* $view->preExecute(); // Pre-execute the query.
* $view->execute(); // Run the query
* $output = $view->render(); // Render the view
* @endcode
......@@ -61,7 +61,7 @@ function is_default_display() { return TRUE; }
*
* You can also do:
* @code
* $view->set_arguments($args);
* $view->setArguments($args);
* $output = $view->render('default'); // Render the view
* @endcode
*
......
......@@ -722,7 +722,7 @@ function get_path() {
}
function get_url() {
return $this->view->get_url();
return $this->view->getUrl();
}
/**
......@@ -866,7 +866,7 @@ function &get_handler($type, $id) {
function get_handlers($type) {
if (!isset($this->handlers[$type])) {
$this->handlers[$type] = array();
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$plural = $types[$type]['plural'];
foreach ($this->get_option($plural) as $id => $info) {
......@@ -887,7 +887,7 @@ function get_handlers($type) {
$override = NULL;
if ($this->use_group_by() && !empty($info['group_type'])) {
if (empty($this->view->query)) {
$this->view->init_query();
$this->view->initQuery();
}
$aggregate = $this->view->query->get_aggregation_info();
if (!empty($aggregate[$info['group_type']]['handler'][$type])) {
......@@ -1214,7 +1214,7 @@ function options_summary(&$categories, &$options) {
);
}
$this->view->init_query();
$this->view->initQuery();
if ($this->view->query->get_aggregation_info()) {
$options['group_by'] = array(
'category' => 'other',
......@@ -1577,7 +1577,7 @@ function options_form(&$form, &$form_state) {
$plugin_name = $query_options['type'];
$form['#title'] .= t('Query options');
$this->view->init_query();
$this->view->initQuery();
if ($this->view->query) {
$form['query'] = array(
'#tree' => TRUE,
......@@ -2478,7 +2478,7 @@ function render_more_link() {
if ($path) {
if (empty($override_path)) {
$path = $this->view->get_url(NULL, $path);
$path = $this->view->getUrl(NULL, $path);
}
$url_options = array();
if (!empty($this->view->exposed_raw_input)) {
......@@ -2572,11 +2572,11 @@ function access($account = NULL) {
* overridden on an individual display.
*/
function pre_execute() {
$this->view->set_use_ajax($this->isAJAXEnabled());
$this->view->setUseAJAX($this->isAJAXEnabled());
if ($this->usesMore() && !$this->use_more_always()) {
$this->view->get_total_rows = TRUE;
}
$this->view->init_handlers();
$this->view->initHandlers();
if ($this->uses_exposed()) {
$exposed_form = $this->get_plugin('exposed_form');
$exposed_form->pre_execute();
......@@ -2657,7 +2657,7 @@ function validate() {
}
// Validate handlers
foreach (View::views_object_types() as $type => $info) {
foreach (View::viewsObjectTypes() as $type => $info) {
foreach ($this->get_handlers($type) as $handler) {
$result = $handler->validate();
if (!empty($result) && is_array($result)) {
......@@ -2682,7 +2682,7 @@ function validate() {
*
*/
function is_identifier_unique($id, $identifier) {
foreach (View::views_object_types() as $type => $info) {
foreach (View::viewsObjectTypes() as $type => $info) {
foreach ($this->get_handlers($type) as $key => $handler) {
if ($handler->can_expose() && $handler->is_exposed()) {
if ($handler->is_a_group()) {
......@@ -2729,7 +2729,7 @@ function view_special_blocks($type) {
if (arg(0) == 'admin' && arg(1) == 'structure' && arg(2) == 'views') {
return;
}
$this->view->init_handlers();
$this->view->initHandlers();
if ($this->uses_exposed() && $this->get_option('exposed_block')) {
$exposed_form = $this->get_plugin('exposed_form');
......@@ -2786,7 +2786,7 @@ function export_handler($indent, $prefix, $storage, $option, $definition, $paren
else {
$type = $option;
}
$types = View::views_object_types();
$types = View::viewsObjectTypes();
foreach ($storage[$option] as $id => $info) {
if (!empty($types[$type]['type'])) {
$handler_type = $types[$type]['type'];
......@@ -2800,7 +2800,7 @@ function export_handler($indent, $prefix, $storage, $option, $definition, $paren
$override = NULL;
if ($this->use_group_by() && !empty($info['group_type'])) {
if (empty($this->view->query)) {
$this->view->init_query();
$this->view->initQuery();
}
$aggregate = $this->view->query->get_aggregation_info();
if (!empty($aggregate[$info['group_type']]['handler'][$type])) {
......@@ -2944,7 +2944,7 @@ function unpack_handler(&$translatable, $storage, $option, $definition, $parents
else {
$type = $option;
}
$types = View::views_object_types();
$types = View::viewsObjectTypes();
foreach ($storage[$option] as $id => $info) {
if (!empty($types[$type]['type'])) {
$handler_type = $types[$type]['type'];
......
......@@ -243,10 +243,10 @@ function attach_to($display_id) {
// attach a feed icon.
$plugin = $this->get_plugin();
if ($plugin) {
$clone = $this->view->clone_view();
$clone->set_display($this->display->id);
$clone->build_title();
$plugin->attach_to($display_id, $this->get_path(), $clone->get_title());
$clone = $this->view->cloneView();
$clone->setDisplay($this->display->id);
$clone->buildTitle();
$plugin->attach_to($display_id, $this->get_path(), $clone->getTitle());
// Clean up
$clone->destroy();
......
......@@ -81,7 +81,7 @@ function execute_hook_menu($callbacks) {
$bits = explode('/', $this->get_option('path'));
$page_arguments = array($this->view->name, $this->display->id);
$this->view->init_handlers();
$this->view->initHandlers();
$view_arguments = $this->view->argument;
// Replace % with %views_arg for menu autoloading and add to the
......@@ -247,7 +247,7 @@ function execute() {
throw new AccessDeniedHttpException();
}
$this->view->get_breadcrumb(TRUE);
$this->view->getBreadcrumb(TRUE);
// And now render the view.
......@@ -255,7 +255,7 @@ function execute() {
// First execute the view so it's possible to get tokens for the title.
// And the title, which is much easier.
drupal_set_title(filter_xss_admin($this->view->get_title()), PASS_THROUGH);
drupal_set_title(filter_xss_admin($this->view->getTitle()), PASS_THROUGH);
return $render;
}
......
......@@ -49,7 +49,7 @@ function render($values) {
$pager = $this->view->pager;
// Get the base count of the pager.
if ($pager->use_pager()) {
$count += ($pager->get_items_per_page() * $pager->get_current_page() + $pager->get_offset());
$count += ($pager->get_items_per_page() * $pager->get_current_page() + $pager->set_offset());
}
// Add the counter for the current site.
$count += $this->view->row_index + 1;
......
......@@ -34,7 +34,7 @@ function option_definition() {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$this->view->init_style();
$this->view->initStyle();
// Allow to choose all fields as possible
if ($this->view->style_plugin->usesFields()) {
......
......@@ -142,7 +142,7 @@ function invoke_translation_process(&$value, $op) {
}
function process_locale_strings($op) {
$this->view->init_display();
$this->view->initDisplay();
foreach ($this->view->display as $display_id => $display) {
$translatable = array();
......
......@@ -1420,7 +1420,7 @@ function build(&$view) {
// Store the view in the object to be able to use it later.
$this->view = $view;
$view->init_pager();
$view->initPager();
// Let the pager modify the query to add limits.
$view->pager->query();
......
......@@ -39,7 +39,7 @@ function option_definition() {
function query() {
if (!empty($this->options['override'])) {
$this->view->set_items_per_page(intval($this->options['items_per_page']));
$this->view->setItemsPerPage(intval($this->options['items_per_page']));
}
}
......
......@@ -35,13 +35,13 @@ class Rss extends StylePluginBase {
function attach_to($display_id, $path, $title) {
$display = $this->view->display[$display_id]->handler;
$url_options = array();
$input = $this->view->get_exposed_input();
$input = $this->view->getExposedInput();
if ($input) {
$url_options['query'] = $input;
}
$url_options['absolute'] = TRUE;
$url = url($this->view->get_url(NULL, $path), $url_options);
$url = url($this->view->getUrl(NULL, $path), $url_options);
if ($display->has_path()) {
if (empty($this->preview)) {
drupal_add_feed($url, $title);
......
......@@ -152,7 +152,7 @@ public function testSimpleArgument() {
$saved_view = clone $view;
// Execute with a view
$view->set_arguments(array(27));
$view->setArguments(array(27));
$this->executeView($view);
// Build the expected result.
......
......@@ -47,8 +47,8 @@ public function testGlossaryView() {
// Execute glossary view
$view = views_get_view('glossary');
$view->set_display('attachment');
$view->execute_display('attachment');
$view->setDisplay('attachment');
$view->executeDisplay('attachment');
// Check that the amount of nodes per char.
$result_nodes_per_char = array();
......
......@@ -37,7 +37,7 @@ function testGlossary() {
}
$view = $this->viewGlossary();
$view->init_display();
$view->initDisplay();
$this->executeView($view);
$count_field = 'nid';
......
......@@ -44,7 +44,7 @@ function testEmpty() {
*/
function _testHideIfEmpty() {
$view = $this->getBasicView();
$view->init_display();
$view->initDisplay();
$this->executeView($view);
$column_map_reversed = array_flip($this->column_map);
......@@ -262,7 +262,7 @@ function _testHideIfEmpty() {
*/
function _testEmptyText() {
$view = $this->getBasicView();
$view->init_display();
$view->initDisplay();
$this->executeView($view);
$column_map_reversed = array_flip($this->column_map);
......@@ -299,8 +299,8 @@ function _testEmptyText() {
*/
function testIsValueEmpty() {
$view = $this->getBasicView();
$view->init_display();
$view->init_handlers();
$view->initDisplay();
$view->initHandlers();
$field = $view->field['name'];
$this->assertFalse($field->is_value_empty("not empty", TRUE), 'A normal string is not empty.');
......
......@@ -42,12 +42,12 @@ function setUp() {
function testOffset() {
$view = $this->views_test_offset();
// Test offset for simple operator.
$view->set_display('default');
$view->init_handlers();
$view->setDisplay('default');
$view->initHandlers();
$view->filter['created']->operator = '>';
$view->filter['created']->value['type'] = 'offset';
$view->filter['created']->value['value'] = '+1 hour';
$view->execute_display('default');
$view->executeDisplay('default');
$expected_result = array(
array('nid' => $this->nodes[3]->nid),
);
......@@ -55,13 +55,13 @@ function testOffset() {
$view->destroy();
// Test offset for between operator.
$view->set_display('default');
$view->init_handlers();
$view->setDisplay('default');
$view->initHandlers();
$view->filter['created']->operator = 'between';
$view->filter['created']->value['type'] = 'offset';
$view->filter['created']->value['max'] = '+2 days';
$view->filter['created']->value['min'] = '+1 hour';
$view->execute_display('default');
$view->executeDisplay('default');
$expected_result = array(
array('nid' => $this->nodes[3]->nid),
);
......@@ -76,12 +76,12 @@ function testOffset() {
function testBetween() {
// Test between with min and max.
$view = $this->views_test_between();
$view->set_display('default');
$view->init_handlers();
$view->setDisplay('default');
$view->initHandlers();
$view->filter['created']->operator = 'between';
$view->filter['created']->value['min'] = format_date(150000, 'custom', 'Y-m-d H:s');
$view->filter['created']->value['max'] = format_date(250000, 'custom', 'Y-m-d H:s');
$view->execute_display('default');
$view->executeDisplay('default');
$expected_result = array(
array('nid' => $this->nodes[1]->nid),
);
......@@ -90,11 +90,11 @@ function testBetween() {
// Test between with just max.
$view = $this->views_test_between();
$view->set_display('default');
$view->init_handlers();
$view->setDisplay('default');
$view->initHandlers();
$view->filter['created']->operator = 'between';
$view->filter['created']->value['max'] = format_date(250000, 'custom', 'Y-m-d H:s');
$view->execute_display('default');
$view->executeDisplay('default');
$expected_result = array(
array('nid' => $this->nodes[0]->nid),
array('nid' => $this->nodes[1]->nid),
......@@ -104,12 +104,12 @@ function testBetween() {
// Test not between with min and max.
$view = $this->views_test_between();
$view->set_display('default');
$view->init_handlers();
$view->setDisplay('default');
$view->initHandlers();
$view->filter['created']->operator = 'not between';
$view->filter['created']->value['min'] = format_date(150000, 'custom', 'Y-m-d H:s');
$view->filter['created']->value['max'] = format_date(250000, 'custom', 'Y-m-d H:s');
$view->execute_display('default');
$view->executeDisplay('default');
$expected_result = array(
array('nid' => $this->nodes[0]->nid),
array('nid' => $this->nodes[2]->nid),
......@@ -120,11 +120,11 @@ function testBetween() {
// Test not between with just max.
$view = $this->views_test_between();
$view->set_display('default');
$view->init_handlers();
$view->setDisplay('default');
$view->initHandlers();
$view->filter['created']->operator = 'not between';
$view->filter['created']->value['max'] = format_date(150000, 'custom', 'Y-m-d H:s');
$view->execute_display('default');
$view->executeDisplay('default');
$expected_result = array(
array('nid' => $this->nodes[1]->nid),
array('nid' => $this->nodes[2]->nid),
......
......@@ -67,7 +67,7 @@ public function testEqualGroupedExposed() {
// Filter: Name, Operator: =, Value: Ringo
$filters['name']['group_info']['default_group'] = 1;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
$this->executeView($view);
......@@ -118,7 +118,7 @@ public function testEqualGroupedNotExposed() {
// Filter: Name, Operator: !=, Value: Ringo
$filters['name']['group_info']['default_group'] = 2;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
$this->executeView($view);
......
......@@ -110,7 +110,7 @@ public function testFilterInOperatorGroupedExposedSimple() {
// Filter: Age, Operator: in, Value: 26, 30
$filters['age']['group_info']['default_group'] = 1;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
$this->executeView($view);
......@@ -139,7 +139,7 @@ public function testFilterNotInOperatorGroupedExposedSimple() {
// Filter: Age, Operator: in, Value: 26, 30
$filters['age']['group_info']['default_group'] = 2;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
$this->executeView($view);
......
......@@ -72,7 +72,7 @@ public function testFilterNumericExposedGroupedSimple() {
// Filter: Age, Operator: =, Value: 28
$filters['age']['group_info']['default_group'] = 1;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
$this->executeView($view);
......@@ -163,7 +163,7 @@ public function testFilterNumericExposedGroupedBetween() {
// Filter: Age, Operator: between, Value: 26 and 29
$filters['age']['group_info']['default_group'] = 2;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
......@@ -191,7 +191,7 @@ public function testFilterNumericExposedGroupedNotBetween() {
// Filter: Age, Operator: between, Value: 26 and 29
$filters['age']['group_info']['default_group'] = 3;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
......@@ -280,7 +280,7 @@ public function testFilterNumericExposedGroupedEmpty() {
// Filter: Age, Operator: empty, Value:
$filters['age']['group_info']['default_group'] = 4;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
......@@ -296,7 +296,7 @@ public function testFilterNumericExposedGroupedNotEmpty() {
// Filter: Age, Operator: empty, Value:
$filters['age']['group_info']['default_group'] = 5;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
......@@ -345,8 +345,8 @@ public function testAllowEmpty() {
),
));
$view->set_display('default');
$view->init_handlers();
$view->setDisplay('default');
$view->initHandlers();
$id_operators = $view->filter['id']->operators();
$age_operators = $view->filter['age']->operators();
......
......@@ -108,7 +108,7 @@ function testFilterStringGroupedExposedEqual() {
// Filter: Name, Operator: =, Value: Ringo
$filters['name']['group_info']['default_group'] = 1;
$view->set_display('page_1');
$view->setDisplay('page_1');
$view->display['page_1']->handler->override_option('filters', $filters);
$this->executeView($view);
......@@ -162,7 +162,7 @@ function testFilterStringGroupedExposedNotEqual() {
// Filter: Name, Operator: !=, Value: Ringo
$filters['name']['group_info']['default_group'] = '2';