Issue #1767030 by dawehner: Rename uiName to adminLabel.

8.0.x
dereine 2012-09-03 20:44:24 +02:00 committed by Tim Plunkett
parent afb01e60c5
commit c09fe055be
20 changed files with 48 additions and 49 deletions

View File

@ -2276,7 +2276,7 @@ function views_ui_edit_form_get_bucket($type, $view, $display) {
continue; continue;
} }
$field_name = check_plain($handler->uiName(TRUE)); $field_name = check_plain($handler->adminLabel(TRUE));
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) { if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$field_name = '(' . $relationships[$field['relationship']] . ') ' . $field_name; $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); $handler = $display->handler->getHandler($type, $id);
if ($handler) { if ($handler) {
$name = $handler->uiName() . ' ' . $handler->adminSummary(); $name = $handler->adminLabel() . ' ' . $handler->adminSummary();
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) { if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$name = '(' . $relationships[$field['relationship']] . ') ' . $name; $name = '(' . $relationships[$field['relationship']] . ') ' . $name;
} }
@ -3726,7 +3726,7 @@ function views_ui_rearrange_filter_form($form, &$form_state) {
); );
if ($handler) { if ($handler) {
$name = $handler->uiName() . ' ' . $handler->adminSummary(); $name = $handler->adminLabel() . ' ' . $handler->adminSummary();
if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) { if (!empty($field['relationship']) && !empty($relationships[$field['relationship']])) {
$name = '(' . $relationships[$field['relationship']] . ') ' . $name; $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'])) { if (!empty($handler->definition['help'])) {
$form['options']['form_description'] = array( $form['options']['form_description'] = array(
@ -4476,7 +4476,7 @@ function views_ui_config_item_group_form($type, &$form_state) {
$handler->init($view, $item); $handler->init($view, $item);
$types = View::viewsObjectTypes(); $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); $handler->buildGroupByForm($form['options'], $form_state);
$form_state['handler'] = &$handler; $form_state['handler'] = &$handler;
@ -4577,7 +4577,7 @@ function views_ui_config_item_extra_form($form, &$form_state) {
$handler->init($view, $item); $handler->init($view, $item);
$types = View::viewsObjectTypes(); $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; $form['#section'] = $display_id . '-' . $type . '-' . $id;
@ -4648,7 +4648,7 @@ function views_ui_config_style_form($form, &$form_state) {
$handler->init($view, $item); $handler->init($view, $item);
$types = View::viewsObjectTypes(); $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'; $form['#section'] = $display_id . '-' . $type . '-style-options';

View File

@ -143,7 +143,7 @@ abstract class HandlerBase extends PluginBase {
$options['field'] = array('default' => ''); $options['field'] = array('default' => '');
$options['relationship'] = array('default' => 'none'); $options['relationship'] = array('default' => 'none');
$options['group_type'] = array('default' => 'group'); $options['group_type'] = array('default' => 'group');
$options['ui_name'] = array('default' => '', 'translatable' => TRUE); $options['admin_label'] = array('default' => '', 'translatable' => TRUE);
return $options; return $options;
} }
@ -151,9 +151,9 @@ abstract class HandlerBase extends PluginBase {
/** /**
* Return a string representing this handler's name in the UI. * Return a string representing this handler's name in the UI.
*/ */
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
if (!empty($this->options['ui_name'])) { if (!empty($this->options['admin_label'])) {
$title = check_plain($this->options['ui_name']); $title = check_plain($this->options['admin_label']);
return $title; return $title;
} }
$title = ($short && isset($this->definition['title short'])) ? $this->definition['title short'] : $this->definition['title']; $title = ($short && isset($this->definition['title short'])) ? $this->definition['title short'] : $this->definition['title'];
@ -275,11 +275,11 @@ abstract class HandlerBase extends PluginBase {
// be moved to their fieldset during pre_render. // be moved to their fieldset during pre_render.
$form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup'; $form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup';
$form['ui_name'] = array( $form['admin_label'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Administrative title'), '#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.'), '#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', '#fieldset' => 'more',
); );
@ -319,7 +319,7 @@ abstract class HandlerBase extends PluginBase {
$id = $form_state['id']; $id = $form_state['id'];
$form['#title'] = check_plain($view->display[$display_id]->display_title) . ': '; $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; $form['#section'] = $display_id . '-' . $type . '-' . $id;

View File

@ -42,7 +42,7 @@ abstract class AreaPluginBase extends HandlerBase {
*/ */
public function label() { public function label() {
if (!isset($this->options['label'])) { if (!isset($this->options['label'])) {
return $this->ui_name(); return $this->admin_label();
} }
return $this->options['label']; return $this->options['label'];
} }

View File

@ -20,7 +20,7 @@ use Drupal\Core\Annotation\Plugin;
*/ */
class Broken extends AreaPluginBase { class Broken extends AreaPluginBase {
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return t('Broken/missing handler'); return t('Broken/missing handler');
} }

View File

@ -49,13 +49,13 @@ class Text extends AreaPluginBase {
// Get a list of the available fields and arguments for token replacement. // Get a list of the available fields and arguments for token replacement.
$options = array(); $options = array();
foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) { 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. $count = 0; // This lets us prepare the key as we want it printed.
foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { 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 title', array('@argument' => $handler->adminLabel()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName())); $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel()));
} }
if (!empty($options)) { if (!empty($options)) {

View File

@ -20,7 +20,7 @@ use Drupal\Core\Annotation\Plugin;
*/ */
class Broken extends ArgumentPluginBase { class Broken extends ArgumentPluginBase {
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return t('Broken/missing handler'); return t('Broken/missing handler');
} }

View File

@ -28,8 +28,8 @@ class GroupByNumeric extends ArgumentPluginBase {
$this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument)); $this->query->add_having_expression(0, "$field = $placeholder", array($placeholder => $this->argument));
} }
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return $this->getField(parent::uiName($short)); return $this->getField(parent::adminLabel($short));
} }
function get_sort_name() { function get_sort_name() {

View File

@ -943,7 +943,7 @@ abstract class DisplayPluginBase extends PluginBase {
$relationships[$relationship] = $label; $relationships[$relationship] = $label;
} }
else { else {
$relationships[$relationship] = $handler->uiName(); $relationships[$relationship] = $handler->adminLabel();
} }
} }
@ -956,7 +956,7 @@ abstract class DisplayPluginBase extends PluginBase {
$options[$id] = $label; $options[$id] = $label;
} }
else { else {
$options[$id] = $handler->uiName(); $options[$id] = $handler->adminLabel();
} }
if (!empty($handler->options['relationship']) && !empty($relationships[$handler->options['relationship']])) { if (!empty($handler->options['relationship']) && !empty($relationships[$handler->options['relationship']])) {
$options[$id] = '(' . $relationships[$handler->options['relationship']] . ') ' . $options[$id]; $options[$id] = '(' . $relationships[$handler->options['relationship']] . ') ' . $options[$id];
@ -1717,8 +1717,8 @@ abstract class DisplayPluginBase extends PluginBase {
$options = array(); $options = array();
$count = 0; // This lets us prepare the key as we want it printed. $count = 0; // This lets us prepare the key as we want it printed.
foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { 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 title', array('@argument' => $handler->adminLabel()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName())); $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel()));
} }
// Default text. // Default text.
@ -1864,7 +1864,7 @@ abstract class DisplayPluginBase extends PluginBase {
if ($plugin->usesFields()) { if ($plugin->usesFields()) {
foreach ($this->getHandlers('field') as $id => $handler) { 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 @@ abstract class DisplayPluginBase extends PluginBase {
$handler = views_get_handler($info['table'], $info['field'], $handler_type, $override); $handler = views_get_handler($info['table'], $info['field'], $handler_type, $override);
if ($handler) { if ($handler) {
$handler->init($this->view, $info); $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']"); $output .= $handler->exportOptions($indent, $prefix . "['$option']['$id']");
} }

View File

@ -20,7 +20,7 @@ use Drupal\Core\Annotation\Plugin;
*/ */
class Broken extends FieldPluginBase { class Broken extends FieldPluginBase {
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return t('Broken/missing handler'); return t('Broken/missing handler');
} }

View File

@ -851,7 +851,7 @@ abstract class FieldPluginBase extends HandlerBase {
// Get a list of the available fields and arguments for token replacement. // Get a list of the available fields and arguments for token replacement.
$options = array(); $options = array();
foreach ($this->view->display_handler->getHandlers('field') as $field => $handler) { 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. // We only use fields up to (and including) this one.
if ($field == $this->options['id']) { if ($field == $this->options['id']) {
break; break;
@ -859,8 +859,8 @@ abstract class FieldPluginBase extends HandlerBase {
} }
$count = 0; // This lets us prepare the key as we want it printed. $count = 0; // This lets us prepare the key as we want it printed.
foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) { 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 title', array('@argument' => $handler->adminLabel()));
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->uiName())); $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel()));
} }
$this->document_self_tokens($options[t('Fields')]); $this->document_self_tokens($options[t('Fields')]);
@ -1625,8 +1625,8 @@ If you would like to have the characters \'[\' and \']\' please use the html ent
return $themes; return $themes;
} }
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return $this->getField(parent::uiName($short)); return $this->getField(parent::adminLabel($short));
} }
} }

View File

@ -20,7 +20,7 @@ use Drupal\Core\Annotation\Plugin;
*/ */
class Broken extends FilterPluginBase { class Broken extends FilterPluginBase {
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return t('Broken/missing handler'); return t('Broken/missing handler');
} }

View File

@ -40,7 +40,7 @@ class Combine extends String {
if ($this->view->style_plugin->usesFields()) { if ($this->view->style_plugin->usesFields()) {
$options = array(); $options = array();
foreach ($this->view->display_handler->getHandlers('field') as $name => $field) { foreach ($this->view->display_handler->getHandlers('field') as $name => $field) {
$options[$name] = $field->uiName(TRUE); $options[$name] = $field->adminLabel(TRUE);
} }
if ($options) { if ($options) {
$form['fields'] = array( $form['fields'] = array(

View File

@ -57,8 +57,8 @@ class GroupByNumeric extends Numeric {
$this->query->add_having_expression($this->options['group'], "$field $operator"); $this->query->add_having_expression($this->options['group'], "$field $operator");
} }
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return $this->getField(parent::uiName($short)); return $this->getField(parent::adminLabel($short));
} }
function can_group() { return FALSE; } function can_group() { return FALSE; }

View File

@ -406,7 +406,7 @@ class InOperator extends FilterPluginBase {
} }
if (!in_array($this->operator, $this->operator_values(1))) { 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 (is_array($this->value)) {
if (!isset($this->value_options)) { if (!isset($this->value_options)) {
@ -429,11 +429,11 @@ class InOperator extends FilterPluginBase {
} }
// Choose different kind of ouput for 0, a single and multiple values. // Choose different kind of ouput for 0, a single and multiple values.
if (count($this->value) == 0) { 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')) { 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; return $errors;
} }

View File

@ -20,7 +20,7 @@ use Drupal\Core\Annotation\Plugin;
*/ */
class Broken extends RelationshipPluginBase { class Broken extends RelationshipPluginBase {
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return t('Broken/missing handler'); return t('Broken/missing handler');
} }

View File

@ -64,12 +64,11 @@ abstract class RelationshipPluginBase extends HandlerBase {
*/ */
function label() { function label() {
if (!isset($this->options['label'])) { if (!isset($this->options['label'])) {
return $this->ui_name(); return $this->adminLabel();
} }
return $this->options['label']; return $this->options['label'];
} }
protected function defineOptions() { protected function defineOptions() {
$options = parent::defineOptions(); $options = parent::defineOptions();

View File

@ -20,7 +20,7 @@ use Drupal\Core\Annotation\Plugin;
*/ */
class Broken extends SortPluginBase { class Broken extends SortPluginBase {
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return t('Broken/missing handler'); return t('Broken/missing handler');
} }

View File

@ -39,8 +39,8 @@ class GroupByNumeric extends SortPluginBase {
$this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order'], NULL, $params); $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order'], NULL, $params);
} }
public function uiName($short = FALSE) { public function adminLabel($short = FALSE) {
return $this->getField(parent::uiName($short)); return $this->getField(parent::adminLabel($short));
} }
} }

View File

@ -37,7 +37,7 @@ class Score extends Numeric {
$handlers = $this->view->display_handler->getHandlers('field'); $handlers = $this->view->display_handler->getHandlers('field');
$options = array('' => t('No alternate')); $options = array('' => t('No alternate'));
foreach ($handlers as $id => $handler) { foreach ($handlers as $id => $handler) {
$options[$id] = $handler->uiName(); $options[$id] = $handler->adminLabel();
} }
$form['alternate_sort'] = array( $form['alternate_sort'] = array(

View File

@ -485,7 +485,7 @@ function views_ui_view_preview_section_handler_links($view, $type, $title = FALS
} }
foreach ($handlers as $id => $handler) { foreach ($handlers as $id => $handler) {
$field_name = $handler->uiName(TRUE); $field_name = $handler->adminLabel(TRUE);
$links[$type . '-edit-' . $id] = array( $links[$type . '-edit-' . $id] = array(
'title' => t('Edit @section', array('@section' => $field_name)), 'title' => t('Edit @section', array('@section' => $field_name)),
'href' => "admin/structure/views/nojs/config-item/$view->name/$display->id/$type/$id", 'href' => "admin/structure/views/nojs/config-item/$view->name/$display->id/$type/$id",