From c09fe055be94310df4adfa3383fa919905309248 Mon Sep 17 00:00:00 2001 From: dereine <dereine@99340.no-reply.drupal.org> Date: Mon, 3 Sep 2012 20:44:24 +0200 Subject: [PATCH] Issue #1767030 by dawehner: Rename uiName to adminLabel. --- includes/admin.inc | 14 +++++++------- lib/Drupal/views/Plugin/views/HandlerBase.php | 14 +++++++------- .../views/Plugin/views/area/AreaPluginBase.php | 2 +- lib/Drupal/views/Plugin/views/area/Broken.php | 2 +- lib/Drupal/views/Plugin/views/area/Text.php | 6 +++--- lib/Drupal/views/Plugin/views/argument/Broken.php | 2 +- .../views/Plugin/views/argument/GroupByNumeric.php | 4 ++-- .../Plugin/views/display/DisplayPluginBase.php | 12 ++++++------ lib/Drupal/views/Plugin/views/field/Broken.php | 2 +- .../views/Plugin/views/field/FieldPluginBase.php | 10 +++++----- lib/Drupal/views/Plugin/views/filter/Broken.php | 2 +- lib/Drupal/views/Plugin/views/filter/Combine.php | 2 +- .../views/Plugin/views/filter/GroupByNumeric.php | 4 ++-- .../views/Plugin/views/filter/InOperator.php | 6 +++--- .../views/Plugin/views/relationship/Broken.php | 2 +- .../views/relationship/RelationshipPluginBase.php | 3 +-- lib/Drupal/views/Plugin/views/sort/Broken.php | 2 +- .../views/Plugin/views/sort/GroupByNumeric.php | 4 ++-- lib/Views/search/Plugin/views/field/Score.php | 2 +- views_ui.module | 2 +- 20 files changed, 48 insertions(+), 49 deletions(-) diff --git a/includes/admin.inc b/includes/admin.inc index df3baa854cad..b69331e65f22 100644 --- a/includes/admin.inc +++ b/includes/admin.inc @@ -2276,7 +2276,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) { continue; } - $field_name = check_plain($handler->uiName(TRUE)); + $field_name = check_plain($handler->adminLabel(TRUE)); if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) { $field_name = '(' . $relationships[$field['relationship']] . ') ' . $field_name; } @@ -3371,7 +3371,7 @@ function views_ui_rearrange_form($form, &$form_state) { ); $handler = $display->handler->getHandler($type, $id); if ($handler) { - $name = $handler->uiName() . ' ' . $handler->adminSummary(); + $name = $handler->adminLabel() . ' ' . $handler->adminSummary(); if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) { $name = '(' . $relationships[$field['relationship']] . ') ' . $name; } @@ -3726,7 +3726,7 @@ function views_ui_rearrange_filter_form($form, &$form_state) { ); if ($handler) { - $name = $handler->uiName() . ' ' . $handler->adminSummary(); + $name = $handler->adminLabel() . ' ' . $handler->adminSummary(); if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) { $name = '(' . $relationships[$field['relationship']] . ') ' . $name; } @@ -4293,7 +4293,7 @@ function views_ui_config_item_form($form, &$form_state) { ); } - $form['#title'] = t('Configure @type: @item', array('@type' => $types[$type]['lstitle'], '@item' => $handler->uiName())); + $form['#title'] = t('Configure @type: @item', array('@type' => $types[$type]['lstitle'], '@item' => $handler->adminLabel())); if (!empty($handler->definition['help'])) { $form['options']['form_description'] = array( @@ -4476,7 +4476,7 @@ function views_ui_config_item_group_form($type, &$form_state) { $handler->init($view, $item); $types = View::viewsObjectTypes(); - $form['#title'] = t('Configure group settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->uiName())); + $form['#title'] = t('Configure group settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel())); $handler->buildGroupByForm($form['options'], $form_state); $form_state['handler'] = &$handler; @@ -4577,7 +4577,7 @@ function views_ui_config_item_extra_form($form, &$form_state) { $handler->init($view, $item); $types = View::viewsObjectTypes(); - $form['#title'] = t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->uiName())); + $form['#title'] = t('Configure extra settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel())); $form['#section'] = $display_id . '-' . $type . '-' . $id; @@ -4648,7 +4648,7 @@ function views_ui_config_style_form($form, &$form_state) { $handler->init($view, $item); $types = View::viewsObjectTypes(); - $form['#title'] = t('Configure summary style for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->uiName())); + $form['#title'] = t('Configure summary style for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $handler->adminLabel())); $form['#section'] = $display_id . '-' . $type . '-style-options'; diff --git a/lib/Drupal/views/Plugin/views/HandlerBase.php b/lib/Drupal/views/Plugin/views/HandlerBase.php index 202da4a706cc..c825a40aff28 100644 --- a/lib/Drupal/views/Plugin/views/HandlerBase.php +++ b/lib/Drupal/views/Plugin/views/HandlerBase.php @@ -143,7 +143,7 @@ protected function defineOptions() { $options['field'] = array('default' => ''); $options['relationship'] = array('default' => 'none'); $options['group_type'] = array('default' => 'group'); - $options['ui_name'] = array('default' => '', 'translatable' => TRUE); + $options['admin_label'] = array('default' => '', 'translatable' => TRUE); return $options; } @@ -151,9 +151,9 @@ protected function defineOptions() { /** * Return a string representing this handler's name in the UI. */ - public function uiName($short = FALSE) { - if (!empty($this->options['ui_name'])) { - $title = check_plain($this->options['ui_name']); + public function adminLabel($short = FALSE) { + if (!empty($this->options['admin_label'])) { + $title = check_plain($this->options['admin_label']); return $title; } $title = ($short && isset($this->definition['title short'])) ? $this->definition['title short'] : $this->definition['title']; @@ -275,11 +275,11 @@ public function buildOptionsForm(&$form, &$form_state) { // be moved to their fieldset during pre_render. $form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup'; - $form['ui_name'] = array( + $form['admin_label'] = array( '#type' => 'textfield', '#title' => t('Administrative title'), '#description' => t('This title will be displayed on the views edit page instead of the default one. This might be useful if you have the same item twice.'), - '#default_value' => $this->options['ui_name'], + '#default_value' => $this->options['admin_label'], '#fieldset' => 'more', ); @@ -319,7 +319,7 @@ public function buildGroupByForm(&$form, &$form_state) { $id = $form_state['id']; $form['#title'] = check_plain($view->display[$display_id]->display_title) . ': '; - $form['#title'] .= t('Configure aggregation settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $this->uiName())); + $form['#title'] .= t('Configure aggregation settings for @type %item', array('@type' => $types[$type]['lstitle'], '%item' => $this->adminLabel())); $form['#section'] = $display_id . '-' . $type . '-' . $id; diff --git a/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php b/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php index b9757a31c35c..d1bdd5289706 100644 --- a/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php +++ b/lib/Drupal/views/Plugin/views/area/AreaPluginBase.php @@ -42,7 +42,7 @@ public function init(&$view, &$options) { */ public function label() { if (!isset($this->options['label'])) { - return $this->ui_name(); + return $this->admin_label(); } return $this->options['label']; } diff --git a/lib/Drupal/views/Plugin/views/area/Broken.php b/lib/Drupal/views/Plugin/views/area/Broken.php index 760d047d8e30..f84e1a8a86e6 100644 --- a/lib/Drupal/views/Plugin/views/area/Broken.php +++ b/lib/Drupal/views/Plugin/views/area/Broken.php @@ -20,7 +20,7 @@ */ class Broken extends AreaPluginBase { - public function uiName($short = FALSE) { + public function adminLabel($short = FALSE) { return t('Broken/missing handler'); } diff --git a/lib/Drupal/views/Plugin/views/area/Text.php b/lib/Drupal/views/Plugin/views/area/Text.php index c3563c686f69..b696414a7ebc 100644 --- a/lib/Drupal/views/Plugin/views/area/Text.php +++ b/lib/Drupal/views/Plugin/views/area/Text.php @@ -49,13 +49,13 @@ public function buildOptionsForm(&$form, &$form_state) { // Get a list of the available fields and arguments for token replacement. $options = array(); foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) { - $options[t('Fields')]["[$field]"] = $handler->uiName(); + $options[t('Fields')]["[$field]"] = $handler->adminLabel(); } $count = 0; // This lets us prepare the key as we want it printed. foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { - $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->uiName())); - $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName())); + $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel())); } if (!empty($options)) { diff --git a/lib/Drupal/views/Plugin/views/argument/Broken.php b/lib/Drupal/views/Plugin/views/argument/Broken.php index 993bc94175e3..e60299f0e16a 100644 --- a/lib/Drupal/views/Plugin/views/argument/Broken.php +++ b/lib/Drupal/views/Plugin/views/argument/Broken.php @@ -20,7 +20,7 @@ */ class Broken extends ArgumentPluginBase { - public function uiName($short = FALSE) { + public function adminLabel($short = FALSE) { return t('Broken/missing handler'); } diff --git a/lib/Drupal/views/Plugin/views/argument/GroupByNumeric.php b/lib/Drupal/views/Plugin/views/argument/GroupByNumeric.php index 50fd70ced8e0..16976d33060b 100644 --- a/lib/Drupal/views/Plugin/views/argument/GroupByNumeric.php +++ b/lib/Drupal/views/Plugin/views/argument/GroupByNumeric.php @@ -28,8 +28,8 @@ public function query($group_by = FALSE) { $this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument)); } - public function uiName($short = FALSE) { - return $this->getField(parent::uiName($short)); + public function adminLabel($short = FALSE) { + return $this->getField(parent::adminLabel($short)); } function get_sort_name() { diff --git a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index bf388fcef3a1..b8ab779d1fc2 100644 --- a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -943,7 +943,7 @@ public function getFieldLabels() { $relationships[$relationship] = $label; } else { - $relationships[$relationship] = $handler->uiName(); + $relationships[$relationship] = $handler->adminLabel(); } } @@ -956,7 +956,7 @@ public function getFieldLabels() { $options[$id] = $label; } else { - $options[$id] = $handler->uiName(); + $options[$id] = $handler->adminLabel(); } if (!empty($handler->options['relationship']) && !empty($relationships[$handler->options['relationship']])) { $options[$id] = '(' . $relationships[$handler->options['relationship']] . ') ' . $options[$id]; @@ -1717,8 +1717,8 @@ public function buildOptionsForm(&$form, &$form_state) { $options = array(); $count = 0; // This lets us prepare the key as we want it printed. foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { - $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->uiName())); - $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName())); + $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel())); } // Default text. @@ -1864,7 +1864,7 @@ public function buildOptionsForm(&$form, &$form_state) { if ($plugin->usesFields()) { foreach ($this->getHandlers('field') as $id => $handler) { - $funcs[] = $this->optionLink(t('Field @field (ID: @id)', array('@field' => $handler->uiName(), '@id' => $id)), 'analyze-theme-field') . ': ' . $this->formatThemes($handler->themeFunctions()); + $funcs[] = $this->optionLink(t('Field @field (ID: @id)', array('@field' => $handler->adminLabel(), '@id' => $id)), 'analyze-theme-field') . ': ' . $this->formatThemes($handler->themeFunctions()); } } } @@ -2822,7 +2822,7 @@ public function exportHandler($indent, $prefix, $storage, $option, $definition, $handler = views_get_handler($info['table'], $info['field'], $handler_type, $override); if ($handler) { $handler->init($this->view, $info); - $output .= $indent . '/* ' . $types[$type]['stitle'] . ': ' . $handler->uiName() . " */\n"; + $output .= $indent . '/* ' . $types[$type]['stitle'] . ': ' . $handler->adminLabel() . " */\n"; $output .= $handler->exportOptions($indent, $prefix . "['$option']['$id']"); } diff --git a/lib/Drupal/views/Plugin/views/field/Broken.php b/lib/Drupal/views/Plugin/views/field/Broken.php index 65df4676dafd..b6cfa5c7ca85 100644 --- a/lib/Drupal/views/Plugin/views/field/Broken.php +++ b/lib/Drupal/views/Plugin/views/field/Broken.php @@ -20,7 +20,7 @@ */ class Broken extends FieldPluginBase { - public function uiName($short = FALSE) { + public function adminLabel($short = FALSE) { return t('Broken/missing handler'); } diff --git a/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php b/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php index 0607535989da..8fd69d610699 100644 --- a/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php +++ b/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php @@ -851,7 +851,7 @@ public function buildOptionsForm(&$form, &$form_state) { // Get a list of the available fields and arguments for token replacement. $options = array(); foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) { - $options[t('Fields')]["[$field]"] = $handler->uiName(); + $options[t('Fields')]["[$field]"] = $handler->adminLabel(); // We only use fields up to (and including) this one. if ($field == $this->options['id']) { break; @@ -859,8 +859,8 @@ public function buildOptionsForm(&$form, &$form_state) { } $count = 0; // This lets us prepare the key as we want it printed. foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { - $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->uiName())); - $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName())); + $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->adminLabel())); + $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel())); } $this->document_self_tokens($options[t('Fields')]); @@ -1625,8 +1625,8 @@ public function themeFunctions() { return $themes; } - public function uiName($short = FALSE) { - return $this->getField(parent::uiName($short)); + public function adminLabel($short = FALSE) { + return $this->getField(parent::adminLabel($short)); } } diff --git a/lib/Drupal/views/Plugin/views/filter/Broken.php b/lib/Drupal/views/Plugin/views/filter/Broken.php index cf2445ec84d2..b52ae93d70a4 100644 --- a/lib/Drupal/views/Plugin/views/filter/Broken.php +++ b/lib/Drupal/views/Plugin/views/filter/Broken.php @@ -20,7 +20,7 @@ */ class Broken extends FilterPluginBase { - public function uiName($short = FALSE) { + public function adminLabel($short = FALSE) { return t('Broken/missing handler'); } diff --git a/lib/Drupal/views/Plugin/views/filter/Combine.php b/lib/Drupal/views/Plugin/views/filter/Combine.php index dd6621455ecb..41f333c524fc 100644 --- a/lib/Drupal/views/Plugin/views/filter/Combine.php +++ b/lib/Drupal/views/Plugin/views/filter/Combine.php @@ -40,7 +40,7 @@ public function buildOptionsForm(&$form, &$form_state) { if ($this->view->style_plugin->usesFields()) { $options = array(); foreach ($this->view->display_handler->getHandlers('field') as $name => $field) { - $options[$name] = $field->uiName(TRUE); + $options[$name] = $field->adminLabel(TRUE); } if ($options) { $form['fields'] = array( diff --git a/lib/Drupal/views/Plugin/views/filter/GroupByNumeric.php b/lib/Drupal/views/Plugin/views/filter/GroupByNumeric.php index 09cf45926c63..c0118b66223a 100644 --- a/lib/Drupal/views/Plugin/views/filter/GroupByNumeric.php +++ b/lib/Drupal/views/Plugin/views/filter/GroupByNumeric.php @@ -57,8 +57,8 @@ function op_empty($field) { $this->query->add_having_expression($this->options['group'], "$field $operator"); } - public function uiName($short = FALSE) { - return $this->getField(parent::uiName($short)); + public function adminLabel($short = FALSE) { + return $this->getField(parent::adminLabel($short)); } function can_group() { return FALSE; } diff --git a/lib/Drupal/views/Plugin/views/filter/InOperator.php b/lib/Drupal/views/Plugin/views/filter/InOperator.php index d8778d3ad138..139b0286f817 100644 --- a/lib/Drupal/views/Plugin/views/filter/InOperator.php +++ b/lib/Drupal/views/Plugin/views/filter/InOperator.php @@ -406,7 +406,7 @@ public function validate() { } if (!in_array($this->operator, $this->operator_values(1))) { - $errors[] = t('The operator is invalid on filter: @filter.', array('@filter' => $this->uiName(TRUE))); + $errors[] = t('The operator is invalid on filter: @filter.', array('@filter' => $this->adminLabel(TRUE))); } if (is_array($this->value)) { if (!isset($this->value_options)) { @@ -429,11 +429,11 @@ public function validate() { } // Choose different kind of ouput for 0, a single and multiple values. if (count($this->value) == 0) { - $errors[] = t('No valid values found on filter: @filter.', array('@filter' => $this->uiName(TRUE))); + $errors[] = t('No valid values found on filter: @filter.', array('@filter' => $this->adminLabel(TRUE))); } } elseif (!empty($this->value) && ($this->operator == 'in' || $this->operator == 'not in')) { - $errors[] = t('The value @value is not an array for @operator on filter: @filter', array('@value' => views_var_export($this->value), '@operator' => $this->operator, '@filter' => $this->uiName(TRUE))); + $errors[] = t('The value @value is not an array for @operator on filter: @filter', array('@value' => views_var_export($this->value), '@operator' => $this->operator, '@filter' => $this->adminLabel(TRUE))); } return $errors; } diff --git a/lib/Drupal/views/Plugin/views/relationship/Broken.php b/lib/Drupal/views/Plugin/views/relationship/Broken.php index e829449db327..e7300a2befcf 100644 --- a/lib/Drupal/views/Plugin/views/relationship/Broken.php +++ b/lib/Drupal/views/Plugin/views/relationship/Broken.php @@ -20,7 +20,7 @@ */ class Broken extends RelationshipPluginBase { - public function uiName($short = FALSE) { + public function adminLabel($short = FALSE) { return t('Broken/missing handler'); } diff --git a/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php b/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php index 66d55b355760..43a31c5e3d3c 100644 --- a/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php +++ b/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php @@ -64,12 +64,11 @@ public function init(&$view, &$options) { */ function label() { if (!isset($this->options['label'])) { - return $this->ui_name(); + return $this->adminLabel(); } return $this->options['label']; } - protected function defineOptions() { $options = parent::defineOptions(); diff --git a/lib/Drupal/views/Plugin/views/sort/Broken.php b/lib/Drupal/views/Plugin/views/sort/Broken.php index c2f8b6842a55..550158f09144 100644 --- a/lib/Drupal/views/Plugin/views/sort/Broken.php +++ b/lib/Drupal/views/Plugin/views/sort/Broken.php @@ -20,7 +20,7 @@ */ class Broken extends SortPluginBase { - public function uiName($short = FALSE) { + public function adminLabel($short = FALSE) { return t('Broken/missing handler'); } diff --git a/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php b/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php index 524b1a56d9cb..3b7eacd2a66c 100644 --- a/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php +++ b/lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php @@ -39,8 +39,8 @@ public function query() { $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order'], NULL, $params); } - public function uiName($short = FALSE) { - return $this->getField(parent::uiName($short)); + public function adminLabel($short = FALSE) { + return $this->getField(parent::adminLabel($short)); } } diff --git a/lib/Views/search/Plugin/views/field/Score.php b/lib/Views/search/Plugin/views/field/Score.php index b78a04544ce2..13b536ed32c3 100644 --- a/lib/Views/search/Plugin/views/field/Score.php +++ b/lib/Views/search/Plugin/views/field/Score.php @@ -37,7 +37,7 @@ public function buildOptionsForm(&$form, &$form_state) { $handlers = $this->view->display_handler->getHandlers('field'); $options = array('' => t('No alternate')); foreach ($handlers as $id => $handler) { - $options[$id] = $handler->uiName(); + $options[$id] = $handler->adminLabel(); } $form['alternate_sort'] = array( diff --git a/views_ui.module b/views_ui.module index 25d9d1c22e26..3eaad344e939 100644 --- a/views_ui.module +++ b/views_ui.module @@ -485,7 +485,7 @@ function views_ui_view_preview_section_handler_links($view, $type, $title = FALS } foreach ($handlers as $id => $handler) { - $field_name = $handler->uiName(TRUE); + $field_name = $handler->adminLabel(TRUE); $links[$type . '-edit-' . $id] = array( 'title' => t('Edit @section', array('@section' => $field_name)), 'href' => "admin/structure/views/nojs/config-item/$view->name/$display->id/$type/$id", -- GitLab