Issue #1785012 by beltofte, hass, YesCT: Standardize capitalization on actions for node operations: 'revert', 'view', 'edit', 'translate', 'delete'.
parent
148f3b874e
commit
aafa1150d8
|
@ -53,7 +53,7 @@ class RevisionLink extends Link {
|
||||||
$this->options['alter']['path'] = $path;
|
$this->options['alter']['path'] = $path;
|
||||||
$this->options['alter']['query'] = drupal_get_destination();
|
$this->options['alter']['query'] = drupal_get_destination();
|
||||||
|
|
||||||
return !empty($this->options['text']) ? $this->options['text'] : t('view');
|
return !empty($this->options['text']) ? $this->options['text'] : t('View');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,7 +41,7 @@ class RevisionLinkDelete extends RevisionLink {
|
||||||
$this->options['alter']['path'] = 'node/' . $node->nid . "/revisions/$vid/delete";
|
$this->options['alter']['path'] = 'node/' . $node->nid . "/revisions/$vid/delete";
|
||||||
$this->options['alter']['query'] = drupal_get_destination();
|
$this->options['alter']['query'] = drupal_get_destination();
|
||||||
|
|
||||||
return !empty($this->options['text']) ? $this->options['text'] : t('delete');
|
return !empty($this->options['text']) ? $this->options['text'] : t('Delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class RevisionLinkRevert extends RevisionLink {
|
||||||
$this->options['alter']['path'] = 'node/' . $node->nid . "/revisions/$vid/revert";
|
$this->options['alter']['path'] = 'node/' . $node->nid . "/revisions/$vid/revert";
|
||||||
$this->options['alter']['query'] = drupal_get_destination();
|
$this->options['alter']['query'] = drupal_get_destination();
|
||||||
|
|
||||||
return !empty($this->options['text']) ? $this->options['text'] : t('revert');
|
return !empty($this->options['text']) ? $this->options['text'] : t('Revert');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ class NodeTranslationUITest extends EntityTranslationUITest {
|
||||||
|
|
||||||
// Visit translation page.
|
// Visit translation page.
|
||||||
$this->drupalGet('node/' . $article->nid . '/translations');
|
$this->drupalGet('node/' . $article->nid . '/translations');
|
||||||
$this->assertRaw('no translatable fields');
|
$this->assertRaw('No translatable fields');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -556,21 +556,21 @@ function node_admin_nodes() {
|
||||||
$operations = array();
|
$operations = array();
|
||||||
if (node_access('update', $node)) {
|
if (node_access('update', $node)) {
|
||||||
$operations['edit'] = array(
|
$operations['edit'] = array(
|
||||||
'title' => t('edit'),
|
'title' => t('Edit'),
|
||||||
'href' => 'node/' . $node->nid . '/edit',
|
'href' => 'node/' . $node->nid . '/edit',
|
||||||
'query' => $destination,
|
'query' => $destination,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (node_access('delete', $node)) {
|
if (node_access('delete', $node)) {
|
||||||
$operations['delete'] = array(
|
$operations['delete'] = array(
|
||||||
'title' => t('delete'),
|
'title' => t('Delete'),
|
||||||
'href' => 'node/' . $node->nid . '/delete',
|
'href' => 'node/' . $node->nid . '/delete',
|
||||||
'query' => $destination,
|
'query' => $destination,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (module_invoke('translation_entity', 'enabled', 'node', $node->bundle())) {
|
if (module_invoke('translation_entity', 'enabled', 'node', $node->bundle())) {
|
||||||
$operations['translate'] = array(
|
$operations['translate'] = array(
|
||||||
'title' => t('translate'),
|
'title' => t('Translate'),
|
||||||
'href' => 'node/' . $node->nid . '/translations',
|
'href' => 'node/' . $node->nid . '/translations',
|
||||||
'query' => $destination,
|
'query' => $destination,
|
||||||
);
|
);
|
||||||
|
|
|
@ -275,13 +275,13 @@ function node_revision_overview($node) {
|
||||||
. (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
|
. (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
|
||||||
if ($revert_permission) {
|
if ($revert_permission) {
|
||||||
$links['revert'] = array(
|
$links['revert'] = array(
|
||||||
'title' => t('revert'),
|
'title' => t('Revert'),
|
||||||
'href' => "node/$node->nid/revisions/$revision->vid/revert",
|
'href' => "node/$node->nid/revisions/$revision->vid/revert",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($delete_permission) {
|
if ($delete_permission) {
|
||||||
$links['delete'] = array(
|
$links['delete'] = array(
|
||||||
'title' => t('delete'),
|
'title' => t('Delete'),
|
||||||
'href' => "node/$node->nid/revisions/$revision->vid/delete",
|
'href' => "node/$node->nid/revisions/$revision->vid/delete",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class PathLanguageTest extends PathTestBase {
|
||||||
|
|
||||||
// Translate the node into French.
|
// Translate the node into French.
|
||||||
$this->drupalGet('node/' . $english_node->nid . '/translate');
|
$this->drupalGet('node/' . $english_node->nid . '/translate');
|
||||||
$this->clickLink(t('add translation'));
|
$this->clickLink(t('Add translation'));
|
||||||
$edit = array();
|
$edit = array();
|
||||||
$langcode = LANGUAGE_NOT_SPECIFIED;
|
$langcode = LANGUAGE_NOT_SPECIFIED;
|
||||||
$edit["title"] = $this->randomName();
|
$edit["title"] = $this->randomName();
|
||||||
|
|
|
@ -81,7 +81,7 @@ class TextTranslationTest extends WebTestBase {
|
||||||
$this->drupalPost('node/add/article', $edit, t('Save'));
|
$this->drupalPost('node/add/article', $edit, t('Save'));
|
||||||
$node = $this->drupalGetNodeByTitle($edit['title']);
|
$node = $this->drupalGetNodeByTitle($edit['title']);
|
||||||
$this->drupalGet("node/$node->nid/translate");
|
$this->drupalGet("node/$node->nid/translate");
|
||||||
$this->clickLink(t('add translation'));
|
$this->clickLink(t('Add translation'));
|
||||||
$this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, 'The textfield widget is populated.');
|
$this->assertFieldByXPath("//textarea[@name='body[$langcode][0][value]']", $body, 'The textfield widget is populated.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class TextTranslationTest extends WebTestBase {
|
||||||
// Translate the article in french.
|
// Translate the article in french.
|
||||||
$node = $this->drupalGetNodeByTitle($title);
|
$node = $this->drupalGetNodeByTitle($title);
|
||||||
$this->drupalGet("node/$node->nid/translate");
|
$this->drupalGet("node/$node->nid/translate");
|
||||||
$this->clickLink(t('add translation'));
|
$this->clickLink(t('Add translation'));
|
||||||
$this->assertNoText($body[0], t('The body field with delta @delta is hidden.', array('@delta' => 0)));
|
$this->assertNoText($body[0], t('The body field with delta @delta is hidden.', array('@delta' => 0)));
|
||||||
$this->assertText($body[1], t('The body field with delta @delta is shown.', array('@delta' => 1)));
|
$this->assertText($body[1], t('The body field with delta @delta is shown.', array('@delta' => 1)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ function translation_node_overview(Node $node) {
|
||||||
$query = array('query' => array('translation' => $node->nid, 'target' => $langcode));
|
$query = array('query' => array('translation' => $node->nid, 'target' => $langcode));
|
||||||
if (!empty($links->links[$langcode]['href'])) {
|
if (!empty($links->links[$langcode]['href'])) {
|
||||||
$options['add'] = array(
|
$options['add'] = array(
|
||||||
'title' => t('add translation'),
|
'title' => t('Add translation'),
|
||||||
) + $links->links[$langcode];
|
) + $links->links[$langcode];
|
||||||
$options['add'] = NestedArray::mergeDeep($options['add'], $query);
|
$options['add'] = NestedArray::mergeDeep($options['add'], $query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ class EntityTranslationWorkflowsTest extends EntityTranslationTestBase {
|
||||||
$this->assertWorkflows($this->administrator, $expected_status);
|
$this->assertWorkflows($this->administrator, $expected_status);
|
||||||
|
|
||||||
// Check that translation permissions governate the associated operations.
|
// Check that translation permissions governate the associated operations.
|
||||||
$ops = array('create' => t('add'), 'update' => t('edit'), 'delete' => t('delete'));
|
$ops = array('create' => t('Add'), 'update' => t('Edit'), 'delete' => t('Delete'));
|
||||||
$translations_path = $this->controller->getBasePath($this->entity) . "/translations";
|
$translations_path = $this->controller->getBasePath($this->entity) . "/translations";
|
||||||
foreach ($ops as $current_op => $label) {
|
foreach ($ops as $current_op => $label) {
|
||||||
$user = $this->drupalCreateUser(array($this->getTranslatePermission(), "$current_op entity translations"));
|
$user = $this->drupalCreateUser(array($this->getTranslatePermission(), "$current_op entity translations"));
|
||||||
|
@ -135,7 +135,7 @@ class EntityTranslationWorkflowsTest extends EntityTranslationTestBase {
|
||||||
// Check whether the user is allowed to create a translation.
|
// Check whether the user is allowed to create a translation.
|
||||||
$add_translation_path = $translations_path . "/add/$default_langcode/$langcode";
|
$add_translation_path = $translations_path . "/add/$default_langcode/$langcode";
|
||||||
if ($expected_status['add_translation'] == 200) {
|
if ($expected_status['add_translation'] == 200) {
|
||||||
$this->clickLink('add');
|
$this->clickLink('Add');
|
||||||
$this->assertUrl($add_translation_path, $options, 'The translation overview points to the translation form when creating translations.');
|
$this->assertUrl($add_translation_path, $options, 'The translation overview points to the translation form when creating translations.');
|
||||||
// Check that the translation form does not contain shared elements for
|
// Check that the translation form does not contain shared elements for
|
||||||
// translators.
|
// translators.
|
||||||
|
@ -155,13 +155,14 @@ class EntityTranslationWorkflowsTest extends EntityTranslationTestBase {
|
||||||
if ($expected_status['edit_translation'] == 200) {
|
if ($expected_status['edit_translation'] == 200) {
|
||||||
$this->drupalGet($translations_path, $options);
|
$this->drupalGet($translations_path, $options);
|
||||||
$editor = $expected_status['edit'] == 200;
|
$editor = $expected_status['edit'] == 200;
|
||||||
$this->clickLink('edit', intval($editor));
|
|
||||||
|
|
||||||
if ($editor) {
|
if ($editor) {
|
||||||
|
$this->clickLink('Edit', 2);
|
||||||
// An editor should be pointed to the entity form in multilingual mode.
|
// An editor should be pointed to the entity form in multilingual mode.
|
||||||
$this->assertUrl($edit_path, $options, 'The translation overview points to the edit form for editors when editing translations.');
|
$this->assertUrl($edit_path, $options, 'The translation overview points to the edit form for editors when editing translations.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$this->clickLink('Edit');
|
||||||
// While a translator should be pointed to the translation form.
|
// While a translator should be pointed to the translation form.
|
||||||
$this->assertUrl($edit_translation_path, $options, 'The translation overview points to the translation form for translators when editing translations.');
|
$this->assertUrl($edit_translation_path, $options, 'The translation overview points to the translation form for translators when editing translations.');
|
||||||
// Check that the translation form does not contain shared elements.
|
// Check that the translation form does not contain shared elements.
|
||||||
|
|
|
@ -93,7 +93,7 @@ function translation_entity_overview(EntityInterface $entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($links['edit'])) {
|
if (isset($links['edit'])) {
|
||||||
$links['edit']['title'] = t('edit');
|
$links['edit']['title'] = t('Edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
$translation = $entity->translation[$langcode];
|
$translation = $entity->translation[$langcode];
|
||||||
|
@ -109,7 +109,7 @@ function translation_entity_overview(EntityInterface $entity) {
|
||||||
$source_name = isset($languages[$source]) ? $languages[$source]->name : t('n/a');
|
$source_name = isset($languages[$source]) ? $languages[$source]->name : t('n/a');
|
||||||
if ($controller->getTranslationAccess($entity, 'delete')) {
|
if ($controller->getTranslationAccess($entity, 'delete')) {
|
||||||
$links['delete'] = isset($delete_links->links[$langcode]['href']) ? $delete_links->links[$langcode] : array('href' => $delete_links, 'language' => $language);
|
$links['delete'] = isset($delete_links->links[$langcode]['href']) ? $delete_links->links[$langcode] : array('href' => $delete_links, 'language' => $language);
|
||||||
$links['delete']['title'] = t('delete');
|
$links['delete']['title'] = t('Delete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,14 +121,14 @@ function translation_entity_overview(EntityInterface $entity) {
|
||||||
if ($source != $langcode && $controller->getTranslationAccess($entity, 'create')) {
|
if ($source != $langcode && $controller->getTranslationAccess($entity, 'create')) {
|
||||||
if ($translatable) {
|
if ($translatable) {
|
||||||
$links['add'] = isset($add_links->links[$langcode]['href']) ? $add_links->links[$langcode] : array('href' => $add_path, 'language' => $language);
|
$links['add'] = isset($add_links->links[$langcode]['href']) ? $add_links->links[$langcode] : array('href' => $add_path, 'language' => $language);
|
||||||
$links['add']['title'] = t('add');
|
$links['add']['title'] = t('Add');
|
||||||
}
|
}
|
||||||
elseif ($field_ui) {
|
elseif ($field_ui) {
|
||||||
$entity_path = field_ui_bundle_admin_path($entity->entityType(), $entity->bundle());
|
$entity_path = field_ui_bundle_admin_path($entity->entityType(), $entity->bundle());
|
||||||
// Link directly to the fields tab to make it easier to find the
|
// Link directly to the fields tab to make it easier to find the
|
||||||
// setting to enable translation on fields.
|
// setting to enable translation on fields.
|
||||||
$path = $entity_path . '/fields';
|
$path = $entity_path . '/fields';
|
||||||
$links['nofields'] = array('title' => t('no translatable fields'), 'href' => $path, 'language' => $language);
|
$links['nofields'] = array('title' => t('No translatable fields'), 'href' => $path, 'language' => $language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue