Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.
This commit is contained in:
parent
4afb23bbd3
commit
7784f4c23d
929 changed files with 19798 additions and 5304 deletions
|
@ -29,3 +29,19 @@ function content_translation_enable() {
|
|||
$message = t('<a href=":settings_url">Enable translation</a> for <em>content types</em>, <em>taxonomy vocabularies</em>, <em>accounts</em>, or any other element you wish to translate.', $t_args);
|
||||
drupal_set_message($message, 'warning');
|
||||
}
|
||||
|
||||
/**
|
||||
* @addtogroup updates-8.0.0-rc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Rebuild the routes as the content translation routes have now new names.
|
||||
*/
|
||||
function content_translation_update_8001() {
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-8.0.0-rc".
|
||||
*/
|
||||
|
|
|
@ -53,7 +53,7 @@ function content_translation_help($route_name, RouteMatchInterface $route_match)
|
|||
*/
|
||||
function content_translation_module_implements_alter(&$implementations, $hook) {
|
||||
switch ($hook) {
|
||||
// Move some of our hook implementations to the end of the list.
|
||||
// Move our hook_entity_type_alter() implementation to the end of the list.
|
||||
case 'entity_type_alter':
|
||||
$group = $implementations['content_translation'];
|
||||
unset($implementations['content_translation']);
|
||||
|
@ -140,7 +140,11 @@ function content_translation_entity_type_alter(array &$entity_types) {
|
|||
if ($entity_type->hasLinkTemplate('canonical')) {
|
||||
// Provide default route names for the translation paths.
|
||||
if (!$entity_type->hasLinkTemplate('drupal:content-translation-overview')) {
|
||||
$entity_type->setLinkTemplate('drupal:content-translation-overview', $entity_type->getLinkTemplate('canonical') . '/translations');
|
||||
$translations_path = $entity_type->getLinkTemplate('canonical') . '/translations';
|
||||
$entity_type->setLinkTemplate('drupal:content-translation-overview', $translations_path);
|
||||
$entity_type->setLinkTemplate('drupal:content-translation-add', $translations_path . '/add/{source}/{target}');
|
||||
$entity_type->setLinkTemplate('drupal:content-translation-edit', $translations_path . '/edit/{language}');
|
||||
$entity_type->setLinkTemplate('drupal:content-translation-delete', $translations_path . '/delete/{language}');
|
||||
}
|
||||
// @todo Remove this as soon as menu access checks rely on the
|
||||
// controller. See https://www.drupal.org/node/2155787.
|
||||
|
|
|
@ -652,7 +652,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface, E
|
|||
$source = $form_state->getValue(array('source_langcode', 'source'));
|
||||
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$form_state->setRedirect('content_translation.translation_add_' . $entity_type_id, array(
|
||||
$form_state->setRedirect("entity.$entity_type_id.content_translation_add", array(
|
||||
$entity_type_id => $entity->id(),
|
||||
'source' => $source,
|
||||
'target' => $form_object->getFormLangcode($form_state),
|
||||
|
@ -689,7 +689,7 @@ class ContentTranslationHandler implements ContentTranslationHandlerInterface, E
|
|||
$form_state->setRedirectUrl($entity->urlInfo('delete-form'));
|
||||
}
|
||||
else {
|
||||
$form_state->setRedirect('content_translation.translation_delete_' . $entity_type_id, [
|
||||
$form_state->setRedirect("entity.$entity_type_id.content_translation_delete", [
|
||||
$entity_type_id => $entity->id(),
|
||||
'language' => $form_object->getFormLangcode($form_state),
|
||||
]);
|
||||
|
|
|
@ -127,7 +127,7 @@ class ContentTranslationController extends ControllerBase {
|
|||
$langcode = $language->getId();
|
||||
|
||||
$add_url = new Url(
|
||||
'content_translation.translation_add_' . $entity_type_id,
|
||||
"entity.$entity_type_id.content_translation_add",
|
||||
array(
|
||||
'source' => $original,
|
||||
'target' => $language->getId(),
|
||||
|
@ -138,7 +138,7 @@ class ContentTranslationController extends ControllerBase {
|
|||
)
|
||||
);
|
||||
$edit_url = new Url(
|
||||
'content_translation.translation_edit_' . $entity_type_id,
|
||||
"entity.$entity_type_id.content_translation_edit",
|
||||
array(
|
||||
'language' => $language->getId(),
|
||||
$entity_type_id => $entity->id(),
|
||||
|
@ -148,7 +148,7 @@ class ContentTranslationController extends ControllerBase {
|
|||
)
|
||||
);
|
||||
$delete_url = new Url(
|
||||
'content_translation.translation_delete_' . $entity_type_id,
|
||||
"entity.$entity_type_id.content_translation_delete",
|
||||
array(
|
||||
'language' => $language->getId(),
|
||||
$entity_type_id => $entity->id(),
|
||||
|
|
|
@ -112,7 +112,7 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
|
|||
'_admin_route' => $is_admin,
|
||||
)
|
||||
);
|
||||
$collection->add("content_translation.translation_add_$entity_type_id", $route);
|
||||
$collection->add("entity.$entity_type_id.content_translation_add", $route);
|
||||
|
||||
$route = new Route(
|
||||
$path . '/edit/{language}',
|
||||
|
@ -137,7 +137,7 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
|
|||
'_admin_route' => $is_admin,
|
||||
)
|
||||
);
|
||||
$collection->add("content_translation.translation_edit_$entity_type_id", $route);
|
||||
$collection->add("entity.$entity_type_id.content_translation_edit", $route);
|
||||
|
||||
$route = new Route(
|
||||
$path . '/delete/{language}',
|
||||
|
@ -162,7 +162,7 @@ class ContentTranslationRouteSubscriber extends RouteSubscriberBase {
|
|||
'_admin_route' => $is_admin,
|
||||
)
|
||||
);
|
||||
$collection->add("content_translation.translation_delete_$entity_type_id", $route);
|
||||
$collection->add("entity.$entity_type_id.content_translation_delete", $route);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class ContentTranslationEnableTest extends WebTestBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['entity_test', 'menu_link_content'];
|
||||
public static $modules = ['entity_test', 'menu_link_content', 'node'];
|
||||
|
||||
/**
|
||||
* Tests that entity schemas are up-to-date after enabling translation.
|
||||
|
@ -39,6 +39,9 @@ class ContentTranslationEnableTest extends WebTestBase {
|
|||
$requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions') + td");
|
||||
$this->assertEqual(t('Up to date'), trim((string) $requirement_value[0]));
|
||||
|
||||
$this->drupalGet('admin/config/regional/content-language');
|
||||
// The node entity type should not be an option because it has no bundles.
|
||||
$this->assertNoRaw('entity_types[node]');
|
||||
// Enable content translation on entity types that have will have a
|
||||
// content_translation_uid.
|
||||
$edit = [
|
||||
|
@ -47,12 +50,23 @@ class ContentTranslationEnableTest extends WebTestBase {
|
|||
'entity_types[entity_test_mul]' => TRUE,
|
||||
'settings[entity_test_mul][entity_test_mul][translatable]' => TRUE,
|
||||
];
|
||||
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
|
||||
$this->drupalPostForm(NULL, $edit, t('Save configuration'));
|
||||
|
||||
// No pending updates should be available.
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions') + td");
|
||||
$this->assertEqual(t('Up to date'), trim((string) $requirement_value[0]));
|
||||
|
||||
// Create a node type and check the content translation settings are now
|
||||
// available for nodes.
|
||||
$edit = array(
|
||||
'name' => 'foo',
|
||||
'title_label' => 'title for foo',
|
||||
'type' => 'foo',
|
||||
);
|
||||
$this->drupalPostForm('admin/structure/types/add', $edit, t('Save content type'));
|
||||
$this->drupalGet('admin/config/regional/content-language');
|
||||
$this->assertRaw('entity_types[node]');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
$language = ConfigurableLanguage::load($langcode);
|
||||
$values[$langcode] = $this->getNewEntityValues($langcode);
|
||||
|
||||
$add_url = Url::fromRoute('content_translation.translation_add_' . $entity->getEntityTypeId(), [
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [
|
||||
$entity->getEntityTypeId() => $entity->id(),
|
||||
'source' => $default_langcode,
|
||||
'target' => $langcode
|
||||
|
@ -167,7 +168,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
$language = ConfigurableLanguage::load($langcode);
|
||||
$source_langcode = 'it';
|
||||
$edit = array('source_langcode[source]' => $source_langcode);
|
||||
$add_url = Url::fromRoute('content_translation.translation_add_' . $entity->getEntityTypeId(), [
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [
|
||||
$entity->getEntityTypeId() => $entity->id(),
|
||||
'source' => $default_langcode,
|
||||
'target' => $langcode
|
||||
|
@ -180,7 +182,8 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
// Add another translation and mark the other ones as outdated.
|
||||
$values[$langcode] = $this->getNewEntityValues($langcode);
|
||||
$edit = $this->getEditValues($values, $langcode) + array('content_translation[retranslate]' => TRUE);
|
||||
$add_url = Url::fromRoute('content_translation.translation_add_' . $entity->getEntityTypeId(), [
|
||||
$entity_type_id = $entity->getEntityTypeId();
|
||||
$add_url = Url::fromRoute("entity.$entity_type_id.content_translation_add", [
|
||||
$entity->getEntityTypeId() => $entity->id(),
|
||||
'source' => $source_langcode,
|
||||
'target' => $langcode
|
||||
|
@ -207,13 +210,15 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
*/
|
||||
protected function doTestTranslationOverview() {
|
||||
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
|
||||
$this->drupalGet($entity->urlInfo('drupal:content-translation-overview'));
|
||||
$translate_url = $entity->urlInfo('drupal:content-translation-overview');
|
||||
$this->drupalGet($translate_url);
|
||||
$translate_url->setAbsolute(FALSE);
|
||||
|
||||
foreach ($this->langcodes as $langcode) {
|
||||
if ($entity->hasTranslation($langcode)) {
|
||||
$language = new Language(array('id' => $langcode));
|
||||
$view_path = $entity->url('canonical', array('language' => $language));
|
||||
$elements = $this->xpath('//table//a[@href=:href]', array(':href' => $view_path));
|
||||
$view_url = $entity->url('canonical', ['language' => $language]);
|
||||
$elements = $this->xpath('//table//a[@href=:href]', [':href' => $view_url]);
|
||||
$this->assertEqual((string) $elements[0], $entity->getTranslation($langcode)->label(), format_string('Label correctly shown for %language translation.', array('%language' => $langcode)));
|
||||
$edit_path = $entity->url('edit-form', array('language' => $language));
|
||||
$elements = $this->xpath('//table//ul[@class="dropbutton"]/li/a[@href=:href]', array(':href' => $edit_path));
|
||||
|
@ -343,7 +348,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
|
|||
|
||||
// Check that the translator cannot delete the original translation.
|
||||
$args = [$this->entityTypeId => $entity->id(), 'language' => 'en'];
|
||||
$this->drupalGet(Url::fromRoute('content_translation.translation_delete_' . $this->entityTypeId, $args));
|
||||
$this->drupalGet(Url::fromRoute("entity.$this->entityTypeId.content_translation_delete", $args));
|
||||
$this->assertResponse(403);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
|
|||
|
||||
// Create a translation.
|
||||
$this->drupalLogin($this->translator);
|
||||
$add_translation_url = Url::fromRoute('content_translation.translation_add_' . $this->entityTypeId, [$this->entityTypeId => $this->entity->id(), 'source' => $default_langcode, 'target' => $this->langcodes[2]]);
|
||||
$add_translation_url = Url::fromRoute("entity.$this->entityTypeId.content_translation_add", [$this->entityTypeId => $this->entity->id(), 'source' => $default_langcode, 'target' => $this->langcodes[2]]);
|
||||
$this->drupalPostForm($add_translation_url, array(), t('Save'));
|
||||
$this->rebuildContainer();
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
|
|||
$this->assertResponse($expected_status['overview'], SafeMarkup::format('The @user_label has the expected translation overview access.', $args));
|
||||
|
||||
// Check whether the user is allowed to create a translation.
|
||||
$add_translation_url = Url::fromRoute('content_translation.translation_add_' . $this->entityTypeId, [$this->entityTypeId => $this->entity->id(), 'source' => $default_langcode, 'target' => $langcode], $options);
|
||||
$add_translation_url = Url::fromRoute("entity.$this->entityTypeId.content_translation_add", [$this->entityTypeId => $this->entity->id(), 'source' => $default_langcode, 'target' => $langcode], $options);
|
||||
if ($expected_status['add_translation'] == 200) {
|
||||
$this->clickLink('Add');
|
||||
$this->assertUrl($add_translation_url->toString(), [], 'The translation overview points to the translation form when creating translations.');
|
||||
|
@ -193,7 +193,7 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
|
|||
// Check whether the user is allowed to edit a translation.
|
||||
$langcode = $this->langcodes[2];
|
||||
$options['language'] = $languages[$langcode];
|
||||
$edit_translation_url = Url::fromRoute('content_translation.translation_edit_' . $this->entityTypeId, [$this->entityTypeId => $this->entity->id(), 'language' => $langcode], $options);
|
||||
$edit_translation_url = Url::fromRoute("entity.$this->entityTypeId.content_translation_edit", [$this->entityTypeId => $this->entity->id(), 'language' => $langcode], $options);
|
||||
if ($expected_status['edit_translation'] == 200) {
|
||||
$this->drupalGet($translations_url);
|
||||
$editor = $expected_status['edit'] == 200;
|
||||
|
@ -221,7 +221,7 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
|
|||
// Check whether the user is allowed to delete a translation.
|
||||
$langcode = $this->langcodes[2];
|
||||
$options['language'] = $languages[$langcode];
|
||||
$delete_translation_url = Url::fromRoute('content_translation.translation_delete_' . $this->entityTypeId, [$this->entityTypeId => $this->entity->id(), 'language' => $langcode], $options);
|
||||
$delete_translation_url = Url::fromRoute("entity.$this->entityTypeId.content_translation_delete", [$this->entityTypeId => $this->entity->id(), 'language' => $langcode], $options);
|
||||
if ($expected_status['delete_translation'] == 200) {
|
||||
$this->drupalGet($translations_url);
|
||||
$editor = $expected_status['delete'] == 200;
|
||||
|
|
Reference in a new issue