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
......@@ -118,17 +118,17 @@ function views_ui_preview($view, $display_id, $args = array()) {
}
}
$view->set_exposed_input($exposed_input);
$view->setExposedInput($exposed_input);
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
return t('Invalid display id @display', array('@display' => $display_id));
}
$view->set_arguments($args);
$view->setArguments($args);
// Store the current view URL for later use:
if ($view->display_handler->get_option('path')) {
$path = $view->get_url();
$path = $view->getUrl();
}
// Make view links come back to preview.
......@@ -190,7 +190,7 @@ function views_ui_preview($view, $display_id, $args = array()) {
}
}
if ($show_info) {
$rows['query'][] = array('<strong>' . t('Title') . '</strong>', filter_xss_admin($view->get_title()));
$rows['query'][] = array('<strong>' . t('Title') . '</strong>', filter_xss_admin($view->getTitle()));
if (isset($path)) {
$path = l($path, $path);
}
......@@ -781,7 +781,7 @@ function views_ui_taxonomy_autocomplete_validate($element, &$form_state) {
*/
function theme_views_ui_view_info($variables) {
$view = $variables['view'];
$title = $view->get_human_name();
$title = $view->getHumanName();
$displays = _views_ui_get_displays_list($view);
$displays = empty($displays) ? t('None') : format_plural(count($displays), 'Display', 'Displays') . ': ' . '<em>' . implode(', ', $displays) . '</em>';
......@@ -913,7 +913,7 @@ function views_ui_build_preview($view, $display_id, $render = TRUE) {
$build['preview'] = array(
'#theme_wrappers' => array('container'),
'#attributes' => array('id' => 'views-live-preview'),
'#markup' => $render ? views_ui_preview($view->clone_view(), $display_id, $args) : '',
'#markup' => $render ? views_ui_preview($view->cloneView(), $display_id, $args) : '',
);
return $build;
......@@ -942,12 +942,12 @@ function views_ui_edit_form($form, &$form_state, $view, $display_id = NULL) {
$form_state['no_cache'] = TRUE;
if ($display_id) {
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
$form['#markup'] = t('Invalid display id @display', array('@display' => $display_id));
return $form;
}
$view->fix_missing_relationships();
$view->fixMissingRelationships();
}
$form['#attached']['js'][] = ctools_attach_js('collapsible-div');
......@@ -1999,7 +1999,7 @@ function views_ui_import_validate($form, &$form_state) {
// Make sure base table gets set properly if it got moved.
$view->update();
$view->init_display();
$view->initDisplay();
$broken = FALSE;
......@@ -2026,7 +2026,7 @@ function views_ui_import_validate($form, &$form_state) {
}
}
foreach (View::views_object_types() as $type => $info) {
foreach (View::viewsObjectTypes() as $type => $info) {
$handlers = $display->handler->get_handlers($type);
if ($handlers) {
foreach ($handlers as $id => $handler) {
......@@ -2118,7 +2118,7 @@ function views_ui_edit_view_form_submit($form, &$form_state) {
}
$form_state['view']->save();
drupal_set_message(t('The view %name has been saved.', array('%name' => $form_state['view']->get_human_name())));
drupal_set_message(t('The view %name has been saved.', array('%name' => $form_state['view']->getHumanName())));
// Remove this view from cache so we can edit it properly.
views_temp_store()->delete($form_state['view']->name);
......@@ -2154,7 +2154,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
$build = array(
'#theme_wrappers' => array('views_ui_display_tab_bucket'),
);
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$build['#overridden'] = FALSE;
$build['#defaulted'] = FALSE;
......@@ -2344,7 +2344,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
* Regenerate the current tab for AJAX updates.
*/
function views_ui_regenerate_tab(&$view, &$output, $display_id) {
if (!$view->set_display('default')) {
if (!$view->setDisplay('default')) {
return;
}
......@@ -3156,7 +3156,7 @@ function views_ui_edit_details_form($form, &$form_state) {
'#type' => 'textfield',
'#title' => t('Human-readable name'),
'#description' => t('A descriptive human-readable name for this view. Spaces are allowed'),
'#default_value' => $view->get_human_name(),
'#default_value' => $view->getHumanName(),
);
$form['details']['tag'] = array(
'#type' => 'textfield',
......@@ -3200,7 +3200,7 @@ function views_ui_edit_display_form($form, &$form_state) {
$display_id = $form_state['display_id'];
$section = $form_state['section'];
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
$display = &$view->display[$display_id];
......@@ -3276,8 +3276,8 @@ function views_ui_config_type_form($form, &$form_state) {
$display_id = $form_state['display_id'];
$type = $form_state['type'];
$types = View::views_object_types();
if (!$view->set_display($display_id)) {
$types = View::viewsObjectTypes();
if (!$view->setDisplay($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
$display = &$view->display[$display_id];
......@@ -3308,7 +3308,7 @@ function views_ui_config_type_form($form, &$form_state) {
* Submit handler for type configuration form
*/
function views_ui_config_type_form_submit($form, &$form_state) {
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$display = &$form_state['view']->display[$form_state['display_id']];
// Store in cache
......@@ -3323,8 +3323,8 @@ function views_ui_rearrange_form($form, &$form_state) {
$display_id = $form_state['display_id'];
$type = $form_state['type'];
$types = View::views_object_types();
if (!$view->set_display($display_id)) {
$types = View::viewsObjectTypes();
if (!$view->setDisplay($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
$display = &$view->display[$display_id];
......@@ -3555,7 +3555,7 @@ function theme_views_ui_build_group_filter_form($variables) {
* Submit handler for rearranging form.
*/
function views_ui_rearrange_form_submit($form, &$form_state) {
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$display = &$form_state['view']->display[$form_state['display_id']];
$old_fields = $display->handler->get_option($types[$form_state['type']]['plural']);
......@@ -3591,8 +3591,8 @@ function views_ui_rearrange_filter_form($form, &$form_state) {
$display_id = $form_state['display_id'];
$type = $form_state['type'];
$types = View::views_object_types();
if (!$view->set_display($display_id)) {
$types = View::viewsObjectTypes();
if (!$view->setDisplay($display_id)) {
views_ajax_render(t('Invalid display id @display', array('@display' => $display_id)));
}
$display = &$view->display[$display_id];
......@@ -3857,7 +3857,7 @@ function theme_views_ui_rearrange_filter_form(&$vars) {
* Submit handler for rearranging form
*/
function views_ui_rearrange_filter_form_submit($form, &$form_state) {
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$display = &$form_state['view']->display[$form_state['display_id']];
$remember_groups = array();
......@@ -3975,12 +3975,12 @@ function views_ui_add_item_form($form, &$form_state) {
),
);
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
$display = &$view->display[$display_id];
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$ltitle = $types[$type]['ltitle'];
$section = $types[$type]['plural'];
......@@ -3995,7 +3995,7 @@ function views_ui_add_item_form($form, &$form_state) {
views_ui_standard_display_dropdown($form, $form_state, $section);
// Figure out all the base tables allowed based upon what the relationships provide.
$base_tables = $view->get_base_tables();
$base_tables = $view->getBaseTables();
$options = views_fetch_fields(array_keys($base_tables), $type, $display->handler->use_group_by());
if (!empty($options)) {
......@@ -4096,7 +4096,7 @@ function views_ui_add_item_form($form, &$form_state) {
*/
function views_ui_add_item_form_submit($form, &$form_state) {
$type = $form_state['type'];
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$section = $types[$type]['plural'];
// Handle the override select.
......@@ -4212,7 +4212,7 @@ function views_ui_config_item_form($form, &$form_state) {
'#attributes' => array('class' => array('scroll')),
),
);
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
$item = $view->get_item($display_id, $type, $id);
......@@ -4223,7 +4223,7 @@ function views_ui_config_item_form($form, &$form_state) {
$form['markup'] = array('#markup' => t("Error: handler for @table > @field doesn't exist!", array('@table' => $item['table'], '@field' => $item['field'])));
}
else {
$types = View::views_object_types();
$types = View::viewsObjectTypes();
// If this item can come from the default display, show a dropdown
// that lets the user choose which display the changes should apply to.
......@@ -4273,7 +4273,7 @@ function views_ui_config_item_form($form, &$form_state) {
// We want this relationship option to get saved even if the user
// skips submitting the form.
$view->set_item_option($display_id, $type, $id, 'relationship', $rel);
$temp_view = $view->clone_view();
$temp_view = $view->cloneView();
views_ui_cache_set($temp_view);
}
......@@ -4343,7 +4343,7 @@ function views_ui_config_item_form_submit_temporary($form, &$form_state) {
// Run it through the handler's submit function.
$form_state['handler']->options_submit($form['options'], $form_state);
$item = $form_state['handler']->options;
$types = View::views_object_types();
$types = View::viewsObjectTypes();
// For footer/header $handler_type is area but $type is footer/header.
// For all other handle types it's the same.
......@@ -4355,7 +4355,7 @@ function views_ui_config_item_form_submit_temporary($form, &$form_state) {
$override = NULL;
if ($form_state['view']->display_handler->use_group_by() && !empty($item['group_type'])) {
if (empty($form_state['view']->query)) {
$form_state['view']->init_query();
$form_state['view']->initQuery();
}
$aggregate = $form_state['view']->query->get_aggregation_info();
if (!empty($aggregate[$item['group_type']]['handler'][$type])) {
......@@ -4397,7 +4397,7 @@ function views_ui_config_item_form_submit($form, &$form_state) {
// Run it through the handler's submit function.
$form_state['handler']->options_submit($form['options'], $form_state);
$item = $form_state['handler']->options;
$types = View::views_object_types();
$types = View::viewsObjectTypes();
// For footer/header $handler_type is area but $type is footer/header.
// For all other handle types it's the same.
......@@ -4409,7 +4409,7 @@ function views_ui_config_item_form_submit($form, &$form_state) {
$override = NULL;
if ($form_state['view']->display_handler->use_group_by() && !empty($item['group_type'])) {
if (empty($form_state['view']->query)) {
$form_state['view']->init_query();
$form_state['view']->initQuery();
}
$aggregate = $form_state['view']->query->get_aggregation_info();
if (!empty($aggregate[$item['group_type']]['handler'][$type])) {
......@@ -4458,11 +4458,11 @@ function views_ui_config_item_group_form($type, &$form_state) {
'#attributes' => array('class' => array('scroll')),
),
);
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
views_ajax_render(t('Invalid display id @display', array('@display' => $display_id)));
}
$view->init_query();
$view->initQuery();
$item = $view->get_item($display_id, $type, $id);
......@@ -4473,7 +4473,7 @@ function views_ui_config_item_group_form($type, &$form_state) {
}
else {
$handler->init($view, $item);
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$form['#title'] = t('Configure group settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->ui_name()));
......@@ -4562,7 +4562,7 @@ function views_ui_config_item_extra_form($form, &$form_state) {
'#attributes' => array('class' => array('scroll')),
),
);
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
$item = $view->get_item($display_id, $type, $id);
......@@ -4574,7 +4574,7 @@ function views_ui_config_item_extra_form($form, &$form_state) {
}
else {
$handler->init($view, $item);
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$form['#title'] = t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->ui_name()));
......@@ -4633,7 +4633,7 @@ function views_ui_config_style_form($form, &$form_state) {
'#attributes' => array('class' => array('scroll')),
),
);
if (!$view->set_display($display_id)) {
if (!$view->setDisplay($display_id)) {
views_ajax_error(t('Invalid display id @display', array('@display' => $display_id)));
}
$item = $view->get_item($display_id, $type, $id);
......@@ -4645,7 +4645,7 @@ function views_ui_config_style_form($form, &$form_state) {
}
else {
$handler->init($view, $item);
$types = View::views_object_types();
$types = View::viewsObjectTypes();
$form['#title'] = t('Configure summary style for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->ui_name()));
......@@ -5311,7 +5311,7 @@ function views_ui_add_template_page() {
$rows = array();
foreach ($templates as $name => $template) {
$rows[] = array(
array('data' => check_plain($template->get_human_name())),
array('data' => check_plain($template->getHumanName())),
array('data' => check_plain($template->description)),
array('data' => l('add', 'admin/structure/views/template/' . $template->name . '/add')),
);
......@@ -5370,8 +5370,8 @@ function views_ui_field_list() {
$fields = array();
foreach ($views as $view) {
foreach ($view->display as $display_id => $display) {
if ($view->set_display($display_id)) {
foreach (View::views_object_types() as $type => $info) {
if ($view->setDisplay($display_id)) {
foreach (View::viewsObjectTypes() as $type => $info) {
foreach ($view->get_items($type, $display_id) as $item) {
$data = views_fetch_data($item['table']);
if (isset($data[$item['field']]) && isset($data[$item['field']][$type])
......
......@@ -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->