updated core to 8.6.1 via composer

This commit is contained in:
2018-09-12 13:58:26 +02:00
parent a9a219f2ed
commit ea56b9fba3
4443 changed files with 112098 additions and 40708 deletions
+10 -8
View File
@@ -2,7 +2,7 @@
* @file
* Attaches behaviors for the Path module.
*/
(function ($, Drupal) {
(function($, Drupal) {
/**
* Behaviors for settings summaries on path edit forms.
*
@@ -13,13 +13,15 @@
*/
Drupal.behaviors.pathDetailsSummaries = {
attach(context) {
$(context).find('.path-form').drupalSetSummary((context) => {
const path = $('.js-form-item-path-0-alias input').val();
$(context)
.find('.path-form')
.drupalSetSummary(context => {
const path = $('.js-form-item-path-0-alias input').val();
return path ?
Drupal.t('Alias: @alias', { '@alias': path }) :
Drupal.t('No alias');
});
return path
? Drupal.t('Alias: @alias', { '@alias': path })
: Drupal.t('No alias');
});
},
};
}(jQuery, Drupal));
})(jQuery, Drupal);
-23
View File
@@ -8,7 +8,6 @@
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
@@ -37,28 +36,6 @@ function path_help($route_name, RouteMatchInterface $route_match) {
}
}
/**
* Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.
*/
function path_form_node_form_alter(&$form, FormStateInterface $form_state) {
$node = $form_state->getFormObject()->getEntity();
$form['path_settings'] = [
'#type' => 'details',
'#title' => t('URL path settings'),
'#open' => !empty($form['path']['widget'][0]['alias']['#value']),
'#group' => 'advanced',
'#access' => !empty($form['path']['#access']) && $node->hasField('path') && $node->get('path')->access('edit'),
'#attributes' => [
'class' => ['path-form'],
],
'#attached' => [
'library' => ['path/drupal.path'],
],
'#weight' => 30,
];
$form['path']['#group'] = 'path_settings';
}
/**
* Implements hook_entity_base_field_info().
*/
@@ -59,7 +59,8 @@ class PathController extends ControllerBase {
* The request object.
*
* @return array
* A render array as expected by drupal_render().
* A render array as expected by
* \Drupal\Core\Render\RendererInterface::render().
*/
public function adminOverview(Request $request) {
$keys = $request->query->get('search');
+2 -2
View File
@@ -138,7 +138,7 @@ abstract class PathFormBase extends FormBase {
else {
$form['langcode'] = [
'#type' => 'value',
'#value' => $this->path['langcode']
'#value' => $this->path['langcode'],
];
}
@@ -212,7 +212,7 @@ abstract class PathFormBase extends FormBase {
$this->aliasStorage->save($source, $alias, $langcode, $pid);
drupal_set_message($this->t('The alias has been saved.'));
$this->messenger()->addStatus($this->t('The alias has been saved.'));
$form_state->setRedirect('path.admin_overview');
}
@@ -49,6 +49,27 @@ class PathWidget extends WidgetBase {
'#type' => 'value',
'#value' => $items[$delta]->langcode,
];
// If the advanced settings tabs-set is available (normally rendered in the
// second column on wide-resolutions), place the field as a details element
// in this tab-set.
if (isset($form['advanced'])) {
$element += [
'#type' => 'details',
'#title' => t('URL path settings'),
'#open' => !empty($items[$delta]->alias),
'#group' => 'advanced',
'#access' => $entity->get('path')->access('edit'),
'#attributes' => [
'class' => ['path-form'],
],
'#attached' => [
'library' => ['path/drupal.path'],
],
];
$element['#weight'] = 30;
}
return $element;
}
@@ -2,7 +2,6 @@
namespace Drupal\Tests\path\Functional;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Database\Database;
@@ -84,7 +83,7 @@ class PathAliasTest extends PathTestBase {
$this->drupalGet($edit['alias']);
$this->assertText($node1->label(), 'Alias works lower case.');
$this->assertResponse(200);
$this->drupalGet(Unicode::strtoupper($edit['alias']));
$this->drupalGet(mb_strtoupper($edit['alias']));
$this->assertText($node1->label(), 'Alias works upper case.');
$this->assertResponse(200);
@@ -111,7 +110,7 @@ class PathAliasTest extends PathTestBase {
$this->drupalPostForm('admin/config/search/path/edit/' . $pid, $edit, t('Save'));
// Confirm that the alias works.
$this->drupalGet(Unicode::strtoupper($edit['alias']));
$this->drupalGet(mb_strtoupper($edit['alias']));
$this->assertText($node1->label(), 'Changed alias works.');
$this->assertResponse(200);
@@ -133,7 +132,7 @@ class PathAliasTest extends PathTestBase {
$this->assertRaw(t('The alias %alias is already in use in this language.', ['%alias' => $edit['alias']]), 'Attempt to move alias was rejected.');
$edit_upper = $edit;
$edit_upper['alias'] = Unicode::strtoupper($edit['alias']);
$edit_upper['alias'] = mb_strtoupper($edit['alias']);
$this->drupalPostForm('admin/config/search/path/add', $edit_upper, t('Save'));
$this->assertRaw(t('The alias %alias could not be added because it is already in use in this language with different capitalization: %stored_alias.', [
'%alias' => $edit_upper['alias'],
@@ -266,7 +265,7 @@ class PathAliasTest extends PathTestBase {
$this->drupalPostForm('node/' . $node1->id() . '/edit', $edit, t('Save'));
// Confirm that the alias works.
$this->drupalGet(Unicode::strtoupper($edit['path[0][alias]']));
$this->drupalGet(mb_strtoupper($edit['path[0][alias]']));
$this->assertText($node1->label(), 'Changed alias works.');
$this->assertResponse(200);
@@ -4,7 +4,7 @@ namespace Drupal\Tests\path\Functional;
use Drupal\node\Entity\NodeType;
use Drupal\Tests\BrowserTestBase;
use Drupal\workflows\Entity\Workflow;
use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
/**
* Tests path aliases with Content Moderation.
@@ -14,6 +14,8 @@ use Drupal\workflows\Entity\Workflow;
*/
class PathContentModerationTest extends BrowserTestBase {
use ContentModerationTestTrait;
/**
* Modules to install.
*
@@ -32,7 +34,7 @@ class PathContentModerationTest extends BrowserTestBase {
$node_type->save();
// Set the content type as moderated.
$workflow = Workflow::load('editorial');
$workflow = $this->createEditorialWorkflow();
$workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'moderated');
$workflow->save();
@@ -0,0 +1,66 @@
<?php
namespace Drupal\Tests\path\Functional;
use Drupal\media\Entity\MediaType;
/**
* Tests the path media form UI.
*
* @group path
*/
class PathMediaFormTest extends PathTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['media', 'media_test_source'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Create test user and log in.
$web_user = $this->drupalCreateUser(['create media', 'create url aliases']);
$this->drupalLogin($web_user);
}
/**
* Tests the media form UI.
*/
public function testMediaForm() {
$assert_session = $this->assertSession();
// Create media type.
$media_type_id = 'foo';
$media_type = MediaType::create([
'id' => $media_type_id,
'label' => $media_type_id,
'source' => 'test',
'source_configuration' => [],
'field_map' => [],
'new_revision' => FALSE,
]);
$media_type->save();
$this->drupalGet('media/add/' . $media_type_id);
// Make sure we have a vertical tab fieldset and 'Path' field.
$assert_session->elementContains('css', '.form-type-vertical-tabs #edit-path-0 summary', 'URL alias');
$assert_session->fieldExists('path[0][alias]');
// Disable the 'Path' field for this content type.
entity_get_form_display('media', $media_type_id, 'default')
->removeComponent('path')
->save();
$this->drupalGet('media/add/' . $media_type_id);
// See if the whole fieldset is gone now.
$assert_session->elementNotExists('css', '.form-type-vertical-tabs #edit-path-0');
$assert_session->fieldNotExists('path[0][alias]');
}
}
@@ -28,13 +28,15 @@ class PathNodeFormTest extends PathTestBase {
* Tests the node form ui.
*/
public function testNodeForm() {
$assert_session = $this->assertSession();
$this->drupalGet('node/add/page');
// Make sure we have a Path fieldset and Path fields.
$this->assertRaw(' id="edit-path-settings"', 'Path settings details exists');
$this->assertFieldByName('path[0][alias]', NULL, 'Path alias field exists');
// Make sure we have a vertical tab fieldset and 'Path' fields.
$assert_session->elementContains('css', '.form-type-vertical-tabs #edit-path-0 summary', 'URL alias');
$assert_session->fieldExists('path[0][alias]');
// Disable the Path field for this content type.
// Disable the 'Path' field for this content type.
entity_get_form_display('node', 'page', 'default')
->removeComponent('path')
->save();
@@ -42,8 +44,8 @@ class PathNodeFormTest extends PathTestBase {
$this->drupalGet('node/add/page');
// See if the whole fieldset is gone now.
$this->assertNoRaw(' id="edit-path-settings"', 'Path settings details does not exist');
$this->assertNoFieldByName('path[0][alias]', NULL, 'Path alias field does not exist');
$assert_session->elementNotExists('css', '.form-type-vertical-tabs #edit-path-0');
$assert_session->fieldNotExists('path[0][alias]');
}
}
@@ -16,7 +16,14 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['language', 'content_translation', 'path', 'menu_ui'];
public static $modules = [
'language',
'content_translation',
'path',
'menu_ui',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/**
* {@inheritdoc}
@@ -68,7 +75,7 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase {
];
$path = \Drupal::service('path.alias_storage')->load($conditions);
$this->assertPath('1', $conditions, $path);
$this->assertIdentical($id_map->lookupDestinationID([$path['pid']]), ['1'], "Test IdMap");
$this->assertIdentical($id_map->lookupDestinationId([$path['pid']]), ['1'], "Test IdMap");
$conditions = [
'source' => '/node/2',
@@ -18,6 +18,8 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
'content_translation',
'language',
'menu_ui',
// Required for translation migrations.
'migrate_drupal_multilingual',
'node',
'path',
'text',
@@ -42,7 +42,7 @@ class PathNoCanonicalLinkTest extends KernelTestBase {
public function testNoCanonicalLinkTemplate() {
$entity_type = EntityTestTranslatableUISkip::create([
'name' => 'name english',
'language' => 'en'
'language' => 'en',
]);
$entity_type->save();