Update to Drupal 8.1.5. For more information, see https://www.drupal.org/project/drupal/releases/8.1.5
This commit is contained in:
parent
13b6ca7cc2
commit
38ba7c357d
342 changed files with 7814 additions and 1534 deletions
|
@ -8,7 +8,6 @@ source:
|
|||
process:
|
||||
nid: nid
|
||||
vid: vid
|
||||
type: type
|
||||
langcode:
|
||||
plugin: default_value
|
||||
source: language
|
||||
|
|
|
@ -8,7 +8,6 @@ source:
|
|||
process:
|
||||
nid: nid
|
||||
vid: vid
|
||||
type: type
|
||||
langcode:
|
||||
plugin: default_value
|
||||
source: language
|
||||
|
|
|
@ -8,7 +8,6 @@ source:
|
|||
process:
|
||||
nid: nid
|
||||
vid: vid
|
||||
type: type
|
||||
langcode:
|
||||
plugin: default_value
|
||||
source: language
|
||||
|
|
|
@ -8,7 +8,6 @@ source:
|
|||
process:
|
||||
nid: nid
|
||||
vid: vid
|
||||
type: type
|
||||
langcode:
|
||||
plugin: default_value
|
||||
source: language
|
||||
|
|
|
@ -64,6 +64,8 @@ use Drupal\Core\Access\AccessResult;
|
|||
* sure to restore your {node_access} record after node_access_rebuild() is
|
||||
* called.
|
||||
*
|
||||
* For a detailed example, see node_access_example.module.
|
||||
*
|
||||
* @param \Drupal\Core\Session\AccountInterface $account
|
||||
* The account object whose grants are requested.
|
||||
* @param string $op
|
||||
|
@ -73,8 +75,6 @@ use Drupal\Core\Access\AccessResult;
|
|||
* An array whose keys are "realms" of grants, and whose values are arrays of
|
||||
* the grant IDs within this realm that this user is being granted.
|
||||
*
|
||||
* For a detailed example, see node_access_example.module.
|
||||
*
|
||||
* @see node_access_view_all_nodes()
|
||||
* @see node_access_rebuild()
|
||||
* @ingroup node_access
|
||||
|
|
|
@ -463,14 +463,11 @@ function node_revision_load($vid = NULL) {
|
|||
/**
|
||||
* Deletes a node revision.
|
||||
*
|
||||
* @param $revision_id
|
||||
* @param int $revision_id
|
||||
* The revision ID to delete.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the revision deletion was successful; otherwise, FALSE.
|
||||
*/
|
||||
function node_revision_delete($revision_id) {
|
||||
entity_revision_delete('node', $revision_id);
|
||||
\Drupal::entityTypeManager()->getStorage('node')->deleteRevision($revision_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1081,8 +1078,9 @@ function node_query_node_access_alter(AlterableInterface $query) {
|
|||
|
||||
// Bubble the 'user.node_grants:$op' cache context to the current render
|
||||
// context.
|
||||
$request = \Drupal::requestStack()->getCurrentRequest();
|
||||
$renderer = \Drupal::service('renderer');
|
||||
if ($renderer->hasRenderContext()) {
|
||||
if ($request->isMethodSafe() && $renderer->hasRenderContext()) {
|
||||
$build = ['#cache' => ['contexts' => ['user.node_grants:' . $op]]];
|
||||
$renderer->render($build);
|
||||
}
|
||||
|
|
|
@ -22,26 +22,6 @@ class NodePreviewController extends EntityViewController {
|
|||
// Don't render cache previews.
|
||||
unset($build['#cache']);
|
||||
|
||||
foreach ($node_preview->uriRelationships() as $rel) {
|
||||
// Set the node path as the canonical URL to prevent duplicate content.
|
||||
$build['#attached']['html_head_link'][] = array(
|
||||
array(
|
||||
'rel' => $rel,
|
||||
'href' => $node_preview->url($rel),
|
||||
)
|
||||
, TRUE);
|
||||
|
||||
if ($rel == 'canonical') {
|
||||
// Set the non-aliased canonical path as a default shortlink.
|
||||
$build['#attached']['html_head_link'][] = array(
|
||||
array(
|
||||
'rel' => 'shortlink',
|
||||
'href' => $node_preview->url($rel, array('alias' => TRUE)),
|
||||
)
|
||||
, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface {
|
|||
'@type' => $node_type,
|
||||
]);
|
||||
$values['source']['node_type'] = $node_type;
|
||||
$values['destination']['default_bundle'] = $node_type;
|
||||
|
||||
// If this migration is based on the d6_node_revision migration, it
|
||||
// should explicitly depend on the corresponding d6_node variant.
|
||||
|
@ -111,7 +112,7 @@ class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface {
|
|||
$field_type = $info['type'];
|
||||
if ($this->cckPluginManager->hasDefinition($info['type'])) {
|
||||
if (!isset($this->cckPluginCache[$field_type])) {
|
||||
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $migration);
|
||||
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, ['core' => 6], $migration);
|
||||
}
|
||||
$this->cckPluginCache[$field_type]
|
||||
->processCckFieldValues($migration, $field_name, $info);
|
||||
|
|
|
@ -92,6 +92,7 @@ class D7NodeDeriver extends DeriverBase implements ContainerDeriverInterface {
|
|||
'@type' => $row->getSourceProperty('name'),
|
||||
]);
|
||||
$values['source']['node_type'] = $node_type;
|
||||
$values['destination']['default_bundle'] = $node_type;
|
||||
|
||||
$migration = \Drupal::service('plugin.manager.migration')->createStubMigration($values);
|
||||
if (isset($fields[$node_type])) {
|
||||
|
@ -99,7 +100,7 @@ class D7NodeDeriver extends DeriverBase implements ContainerDeriverInterface {
|
|||
$field_type = $info['type'];
|
||||
if ($this->cckPluginManager->hasDefinition($field_type)) {
|
||||
if (!isset($this->cckPluginCache[$field_type])) {
|
||||
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, [], $migration);
|
||||
$this->cckPluginCache[$field_type] = $this->cckPluginManager->createInstance($field_type, ['core' => 7], $migration);
|
||||
}
|
||||
$this->cckPluginCache[$field_type]
|
||||
->processCckFieldValues($migration, $field_name, $info);
|
||||
|
|
|
@ -67,7 +67,7 @@ class Node extends DrupalSqlBase {
|
|||
$query->innerJoin('node', 'n', static::JOIN);
|
||||
|
||||
if (isset($this->configuration['node_type'])) {
|
||||
$query->condition('type', $this->configuration['node_type']);
|
||||
$query->condition('n.type', $this->configuration['node_type']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
|
|
@ -50,7 +50,7 @@ class Node extends FieldableEntity {
|
|||
$query->innerJoin('node', 'n', static::JOIN);
|
||||
|
||||
if (isset($this->configuration['node_type'])) {
|
||||
$query->condition('type', $this->configuration['node_type']);
|
||||
$query->condition('n.type', $this->configuration['node_type']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
|
|
@ -296,6 +296,24 @@ class PagePreviewTest extends NodeTestBase {
|
|||
|
||||
// Check that the revision log field has the correct value.
|
||||
$this->assertFieldByName('revision_log[0][value]', $edit['revision_log[0][value]'], 'Revision log field displayed.');
|
||||
|
||||
// Save the node after coming back from the preview page so we can create a
|
||||
// forward revision for it.
|
||||
$this->drupalPostForm(NULL, [], t('Save'));
|
||||
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
|
||||
|
||||
// Check that previewing a forward revision of a node works. This can not be
|
||||
// accomplished through the UI so we have to use API calls.
|
||||
// @todo Change this test to use the UI when we will be able to create
|
||||
// forward revisions in core.
|
||||
// @see https://www.drupal.org/node/2725533
|
||||
$node->setNewRevision(TRUE);
|
||||
$node->isDefaultRevision(FALSE);
|
||||
|
||||
/** @var \Drupal\Core\Controller\ControllerResolverInterface $controller_resolver */
|
||||
$controller_resolver = \Drupal::service('controller_resolver');
|
||||
$node_preview_controller = $controller_resolver->getControllerFromDefinition('\Drupal\node\Controller\NodePreviewController::view');
|
||||
$node_preview_controller($node, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,12 +74,19 @@ class MigrateNodeTest extends MigrateNodeTestBase {
|
|||
$this->assertIdentical('test rev 3', $node->body->value);
|
||||
$this->assertIdentical('filtered_html', $node->body->format);
|
||||
|
||||
// Test that link fields are migrated.
|
||||
// Test that a link field with an external link is migrated.
|
||||
$this->assertIdentical('http://groups.drupal.org/', $node->field_test_link->uri);
|
||||
$this->assertIdentical('Drupal Groups', $node->field_test_link->title);
|
||||
$this->assertIdentical([], $node->field_test_link->options['attributes']);
|
||||
|
||||
// Rerun migration with invalid link attributes and a different URL and
|
||||
// Test that a link field with an internal link is migrated.
|
||||
$node = Node::load(9);
|
||||
$this->assertSame('internal:/node/10', $node->field_test_link->uri);
|
||||
$this->assertSame('Buy it now', $node->field_test_link->title);
|
||||
$this->assertSame(['attributes' => ['target' => '_blank']], $node->field_test_link->options);
|
||||
|
||||
// Rerun migration with two source database changes.
|
||||
// 1. Add an invalid link attributes and a different URL and
|
||||
// title. If only the attributes are changed the error does not occur.
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('content_type_story')
|
||||
|
@ -92,12 +99,27 @@ class MigrateNodeTest extends MigrateNodeTestBase {
|
|||
->condition('vid', '3')
|
||||
->execute();
|
||||
|
||||
// 2. Add a leading slash to an internal link.
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('content_type_story')
|
||||
->fields([
|
||||
'field_test_link_url' => '/node/10',
|
||||
])
|
||||
->condition('nid', '9')
|
||||
->condition('vid', '12')
|
||||
->execute();
|
||||
|
||||
$this->rerunMigration();
|
||||
$node = Node::load(2);
|
||||
$this->assertIdentical('https://www.drupal.org/node/2127611', $node->field_test_link->uri);
|
||||
$this->assertIdentical('Migrate API in Drupal 8', $node->field_test_link->title);
|
||||
$this->assertIdentical([], $node->field_test_link->options['attributes']);
|
||||
|
||||
$node = Node::load(9);
|
||||
$this->assertSame('internal:/node/10', $node->field_test_link->uri);
|
||||
$this->assertSame('Buy it now', $node->field_test_link->title);
|
||||
$this->assertSame(['attributes' => ['target' => '_blank']], $node->field_test_link->options);
|
||||
|
||||
// Test that we can re-import using the EntityContentBase destination.
|
||||
$title = $this->rerunMigration();
|
||||
$node = Node::load(2);
|
||||
|
|
|
@ -92,7 +92,10 @@ class NodeTest extends MigrateSqlSourceTestCase {
|
|||
'timestamp' => 1279308993,
|
||||
'format' => 1,
|
||||
'field_test_four' => array(
|
||||
array('value' => '3.14159'),
|
||||
array(
|
||||
'value' => '3.14159',
|
||||
'delta' => 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
Reference in a new issue