updated core from 8.4 to 8.5 : bug with login_destination
This commit is contained in:
+3
@@ -2,6 +2,7 @@ id: d6_url_alias
|
||||
label: URL aliases
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
- Content
|
||||
source:
|
||||
plugin: d6_url_alias
|
||||
constants:
|
||||
@@ -26,7 +27,9 @@ process:
|
||||
source: src
|
||||
delimiter: /
|
||||
-
|
||||
# If the source path has no slashes return a dummy default value.
|
||||
plugin: extract
|
||||
default: 'INVALID_NID'
|
||||
index:
|
||||
- 1
|
||||
-
|
||||
+3
@@ -2,6 +2,7 @@ id: d7_url_alias
|
||||
label: URL aliases
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
- Content
|
||||
source:
|
||||
plugin: d7_url_alias
|
||||
constants:
|
||||
@@ -24,7 +25,9 @@ process:
|
||||
source: source
|
||||
delimiter: /
|
||||
-
|
||||
# If the source path has no slashes return a dummy default value.
|
||||
plugin: extract
|
||||
default: 'INVALID_NID'
|
||||
index:
|
||||
- 1
|
||||
-
|
||||
@@ -15,9 +15,9 @@
|
||||
*
|
||||
* @param array $path
|
||||
* The array structure is identical to that of the return value of
|
||||
* \Drupal\Core\Path\PathInterface::save().
|
||||
* \Drupal\Core\Path\AliasStorageInterface::save().
|
||||
*
|
||||
* @see \Drupal\Core\Path\PathInterface::save()
|
||||
* @see \Drupal\Core\Path\AliasStorageInterface::save()
|
||||
*/
|
||||
function hook_path_insert($path) {
|
||||
db_insert('mytable')
|
||||
@@ -33,9 +33,9 @@ function hook_path_insert($path) {
|
||||
*
|
||||
* @param array $path
|
||||
* The array structure is identical to that of the return value of
|
||||
* \Drupal\Core\Path\PathInterface::save().
|
||||
* \Drupal\Core\Path\AliasStorageInterface::save().
|
||||
*
|
||||
* @see \Drupal\Core\Path\PathInterface::save()
|
||||
* @see \Drupal\Core\Path\AliasStorageInterface::save()
|
||||
*/
|
||||
function hook_path_update($path) {
|
||||
if ($path['alias'] != $path['original']['alias']) {
|
||||
@@ -51,9 +51,9 @@ function hook_path_update($path) {
|
||||
*
|
||||
* @param array $path
|
||||
* The array structure is identical to that of the return value of
|
||||
* \Drupal\Core\Path\PathInterface::save().
|
||||
* \Drupal\Core\Path\AliasStorageInterface::save().
|
||||
*
|
||||
* @see \Drupal\Core\Path\PathInterface::delete()
|
||||
* @see \Drupal\Core\Path\AliasStorageInterface::delete()
|
||||
*/
|
||||
function hook_path_delete($path) {
|
||||
db_delete('mytable')
|
||||
|
||||
@@ -6,8 +6,8 @@ package: Core
|
||||
# core: 8.x
|
||||
configure: path.admin_overview
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-01-03
|
||||
version: '8.4.4'
|
||||
# Information added by Drupal.org packaging script on 2018-03-07
|
||||
version: '8.5.0'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1515021228
|
||||
datestamp: 1520457825
|
||||
|
||||
@@ -6,6 +6,8 @@ use Drupal\Core\Language\LanguageInterface;
|
||||
|
||||
/**
|
||||
* Provides the path add form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class AddForm extends PathFormBase {
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Builds the form to delete a path alias.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class DeleteForm extends ConfirmFormBase {
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Provides the path edit form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class EditForm extends PathFormBase {
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Provides the path admin overview filter form.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class PathFilterForm extends FormBase {
|
||||
|
||||
@@ -30,7 +32,7 @@ class PathFilterForm extends FormBase {
|
||||
];
|
||||
$form['basic']['filter'] = [
|
||||
'#type' => 'search',
|
||||
'#title' => 'Path alias',
|
||||
'#title' => $this->t('Path alias'),
|
||||
'#title_display' => 'invisible',
|
||||
'#default_value' => $keys,
|
||||
'#maxlength' => 128,
|
||||
|
||||
@@ -192,7 +192,7 @@ abstract class PathFormBase extends FormBase {
|
||||
}
|
||||
|
||||
if (!$this->pathValidator->isValid(trim($source, '/'))) {
|
||||
$form_state->setErrorByName('source', t("The path '@link_path' is either invalid or you do not have access to it.", ['@link_path' => $source]));
|
||||
$form_state->setErrorByName('source', t("Either the path '@link_path' is invalid or you do not have access to it.", ['@link_path' => $source]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class PathItem extends FieldItemBase {
|
||||
*/
|
||||
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
|
||||
$random = new Random();
|
||||
$values['alias'] = str_replace(' ', '-', strtolower($random->sentences(3)));
|
||||
$values['alias'] = '/' . str_replace(' ', '-', strtolower($random->sentences(3)));
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,6 +103,14 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase {
|
||||
];
|
||||
$path = \Drupal::service('path.alias_storage')->load($conditions);
|
||||
$this->assertPath('3', $conditions, $path);
|
||||
|
||||
$path = \Drupal::service('path.alias_storage')->load(['alias' => '/source-noslash']);
|
||||
$conditions = [
|
||||
'source' => '/admin',
|
||||
'alias' => '/source-noslash',
|
||||
'langcode' => 'und',
|
||||
];
|
||||
$this->assertPath('2', $conditions, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,9 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
|
||||
* Test the URL alias migration.
|
||||
*/
|
||||
public function testUrlAlias() {
|
||||
$path = \Drupal::service('path.alias_storage')->load([
|
||||
$alias_storage = $this->container->get('path.alias_storage');
|
||||
|
||||
$path = $alias_storage->load([
|
||||
'source' => '/taxonomy/term/4',
|
||||
'alias' => '/term33',
|
||||
'langcode' => 'und',
|
||||
@@ -56,6 +58,11 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
|
||||
$this->assertIdentical('/taxonomy/term/4', $path['source']);
|
||||
$this->assertIdentical('/term33', $path['alias']);
|
||||
$this->assertIdentical('und', $path['langcode']);
|
||||
|
||||
// Alias with no slash.
|
||||
$path = $alias_storage->load(['alias' => '/source-noslash']);
|
||||
$this->assertSame('/admin', $path['source']);
|
||||
$this->assertSame('und', $path['langcode']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -189,6 +189,18 @@ class PathItemTest extends KernelTestBase {
|
||||
// Change the alias for the second node to a different one and try again.
|
||||
$second_node->get('path')->alias = '/foobar';
|
||||
$this->assertFalse($node->get('path')->equals($second_node->get('path')));
|
||||
|
||||
// Test the generateSampleValue() method.
|
||||
$node = Node::create([
|
||||
'title' => $this->randomString(),
|
||||
'type' => 'foo',
|
||||
'path' => ['alias' => '/foo'],
|
||||
]);
|
||||
$node->save();
|
||||
$path_field = $node->get('path');
|
||||
$path_field->generateSampleItems();
|
||||
$node->save();
|
||||
$this->assertStringStartsWith('/', $node->get('path')->alias);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user