Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -181,7 +181,7 @@ display:
|
|||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: 'Content Type'
|
||||
label: 'Content type'
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
|
@ -421,7 +421,7 @@ display:
|
|||
exposed: true
|
||||
expose:
|
||||
operator_id: type_op
|
||||
label: Type
|
||||
label: 'Content type'
|
||||
description: ''
|
||||
use_operator: false
|
||||
operator: type_op
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
migrate.source.d6_view_mode:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 view mode'
|
||||
mapping:
|
||||
constants:
|
||||
type: mapping
|
||||
label: 'Constants'
|
||||
mapping:
|
||||
targetEntityType:
|
||||
type: string
|
||||
label: 'Target entity type'
|
||||
status:
|
||||
type: boolean
|
||||
label: 'Status'
|
||||
|
||||
migrate.source.d6_node_type:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 node type'
|
||||
mapping:
|
||||
constants:
|
||||
type: migrate_entity_constant
|
||||
label: 'Constants'
|
||||
|
||||
migrate.source.d6_node:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 node'
|
||||
mapping:
|
||||
node_type:
|
||||
type: string
|
||||
label: 'Node type'
|
||||
|
||||
migrate.source.d7_node:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 7 node'
|
||||
mapping:
|
||||
node_type:
|
||||
type: string
|
||||
label: 'Node type'
|
||||
|
||||
migrate.source.d6_node_revision:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 6 node revision'
|
||||
mapping:
|
||||
node_type:
|
||||
type: string
|
||||
label: 'Node type'
|
||||
|
||||
migrate.source.d7_node_revision:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 7 node revision'
|
||||
mapping:
|
||||
node_type:
|
||||
type: string
|
||||
label: 'Node type'
|
||||
|
||||
migrate.source.d7_node_type:
|
||||
type: migrate_source_sql
|
||||
label: 'Drupal 7 node type'
|
|
@ -3,7 +3,7 @@
|
|||
* Javascript for the node content editing form.
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
(function ($, Drupal) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -59,4 +59,4 @@
|
|||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery, Drupal);
|
||||
|
|
|
@ -2,8 +2,7 @@ id: d6_node
|
|||
label: Nodes
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
builder:
|
||||
plugin: d6_node
|
||||
deriver: Drupal\node\Plugin\migrate\D6NodeDeriver
|
||||
source:
|
||||
plugin: d6_node
|
||||
process:
|
||||
|
|
|
@ -2,8 +2,7 @@ id: d6_node_revision
|
|||
label: Node revisions
|
||||
migration_tags:
|
||||
- Drupal 6
|
||||
builder:
|
||||
plugin: d6_node
|
||||
deriver: Drupal\node\Plugin\migrate\D6NodeDeriver
|
||||
source:
|
||||
plugin: d6_node_revision
|
||||
process:
|
||||
|
|
|
@ -2,8 +2,7 @@ id: d7_node
|
|||
label: Nodes
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
builder:
|
||||
plugin: d7_node
|
||||
deriver: Drupal\node\Plugin\migrate\D7NodeDeriver
|
||||
source:
|
||||
plugin: d7_node
|
||||
process:
|
||||
|
|
|
@ -2,8 +2,7 @@ id: d7_node_revision
|
|||
label: Node revisions
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
builder:
|
||||
plugin: d7_node
|
||||
deriver: Drupal\node\Plugin\migrate\D7NodeDeriver
|
||||
source:
|
||||
plugin: d7_node_revision
|
||||
process:
|
||||
|
@ -28,4 +27,4 @@ destination:
|
|||
plugin: entity_revision:node
|
||||
migration_dependencies:
|
||||
required:
|
||||
- d7_node:*
|
||||
- d7_node
|
||||
|
|
|
@ -102,6 +102,9 @@ function _node_mass_update_helper(NodeInterface $node, array $updates, $langcode
|
|||
* An array of node IDs.
|
||||
* @param array $updates
|
||||
* Associative array of updates.
|
||||
* @param string $langcode
|
||||
* The language updates should be applied to. If none is specified all
|
||||
* available languages are processed.
|
||||
* @param bool $load
|
||||
* TRUE if $nodes contains an array of node IDs to be loaded, FALSE if it
|
||||
* contains fully loaded nodes.
|
||||
|
@ -111,7 +114,7 @@ function _node_mass_update_helper(NodeInterface $node, array $updates, $langcode
|
|||
* @param array|\ArrayAccess $context.
|
||||
* An array of contextual key/values.
|
||||
*/
|
||||
function _node_mass_update_batch_process(array $nodes, array $updates, $load, $revisions, &$context) {
|
||||
function _node_mass_update_batch_process(array $nodes, array $updates, $langcode, $load, $revisions, &$context) {
|
||||
if (!isset($context['sandbox']['progress'])) {
|
||||
$context['sandbox']['progress'] = 0;
|
||||
$context['sandbox']['max'] = count($nodes);
|
||||
|
@ -127,7 +130,7 @@ function _node_mass_update_batch_process(array $nodes, array $updates, $load, $r
|
|||
$node = $revisions ?
|
||||
entity_revision_load('node', $node) : Node::load($node);
|
||||
}
|
||||
$node = _node_mass_update_helper($node, $updates);
|
||||
$node = _node_mass_update_helper($node, $updates, $langcode);
|
||||
|
||||
// Store result for post-processing in the finished callback.
|
||||
$context['results'][] = \Drupal::l($node->label(), $node->urlInfo());
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks specific to the Node module.
|
||||
*/
|
||||
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
||||
/**
|
||||
* @addtogroup hooks
|
||||
* @{
|
||||
|
@ -148,7 +148,7 @@ function hook_node_grants(\Drupal\Core\Session\AccountInterface $account, $op) {
|
|||
* @param \Drupal\node\NodeInterface $node
|
||||
* The node that has just been saved.
|
||||
*
|
||||
* @return array
|
||||
* @return
|
||||
* An array of grants as defined above.
|
||||
*
|
||||
* @see hook_node_access_records_alter()
|
||||
|
@ -336,7 +336,7 @@ function hook_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Se
|
|||
return AccessResult::allowed()->cachePerPermissions();
|
||||
}
|
||||
else {
|
||||
return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->cacheUntilEntityChanges($node);
|
||||
return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
|
||||
}
|
||||
|
||||
case 'delete':
|
||||
|
@ -344,7 +344,7 @@ function hook_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Se
|
|||
return AccessResult::allowed()->cachePerPermissions();
|
||||
}
|
||||
else {
|
||||
return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->cacheUntilEntityChanges($node);
|
||||
return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
entity.node_type.collection:
|
||||
title: 'Content types'
|
||||
parent: system.admin_structure
|
||||
description: 'Create content types and manage their default settings.'
|
||||
description: 'Create and manage fields, forms, and display settings for your content.'
|
||||
route_name: entity.node_type.collection
|
||||
node.add_page:
|
||||
title: 'Add content'
|
||||
|
|
|
@ -324,12 +324,12 @@ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') {
|
|||
$field_storage = FieldStorageConfig::loadByName('node', 'body');
|
||||
$field = FieldConfig::loadByName('node', $type->id(), 'body');
|
||||
if (empty($field)) {
|
||||
$field = entity_create('field_config', array(
|
||||
$field = FieldConfig::create([
|
||||
'field_storage' => $field_storage,
|
||||
'bundle' => $type->id(),
|
||||
'label' => $label,
|
||||
'settings' => array('display_summary' => TRUE),
|
||||
));
|
||||
]);
|
||||
$field->save();
|
||||
|
||||
// Assign widget settings for the 'default' form mode.
|
||||
|
@ -832,6 +832,7 @@ function node_form_system_themes_admin_form_alter(&$form, FormStateInterface $fo
|
|||
$form['admin_theme']['use_admin_theme'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Use the administration theme when editing or creating content'),
|
||||
'#description' => t('Control which roles can "View the administration theme" on the <a href=":permissions">Permissions page</a>.', array(':permissions' => Url::fromRoute('user.admin_permissions')->toString())),
|
||||
'#default_value' => \Drupal::configFactory()->getEditable('node.settings')->get('use_admin_theme'),
|
||||
);
|
||||
$form['#submit'][] = 'node_form_system_themes_admin_form_submit';
|
||||
|
@ -914,7 +915,7 @@ function node_node_access(NodeInterface $node, $op, $account) {
|
|||
return AccessResult::allowed()->cachePerPermissions();
|
||||
}
|
||||
else {
|
||||
return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->cacheUntilEntityChanges($node);
|
||||
return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
|
||||
}
|
||||
|
||||
case 'delete':
|
||||
|
@ -922,7 +923,7 @@ function node_node_access(NodeInterface $node, $op, $account) {
|
|||
return AccessResult::allowed()->cachePerPermissions();
|
||||
}
|
||||
else {
|
||||
return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->cacheUntilEntityChanges($node);
|
||||
return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
|
||||
}
|
||||
|
||||
default:
|
||||
|
@ -1144,6 +1145,7 @@ function node_access_needs_rebuild($rebuild = NULL) {
|
|||
*/
|
||||
function node_access_rebuild($batch_mode = FALSE) {
|
||||
$node_storage = \Drupal::entityManager()->getStorage('node');
|
||||
/** @var \Drupal\node\NodeAccessControlHandlerInterface $access_control_handler */
|
||||
$access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
|
||||
$access_control_handler->deleteGrants();
|
||||
// Only recalculate if the site is using a node_access module.
|
||||
|
@ -1178,7 +1180,8 @@ function node_access_rebuild($batch_mode = FALSE) {
|
|||
// To preserve database integrity, only write grants if the node
|
||||
// loads successfully.
|
||||
if (!empty($node)) {
|
||||
$access_control_handler->writeGrants($node);
|
||||
$grants = $access_control_handler->acquireGrants($node);
|
||||
\Drupal::service('node.grant_storage')->write($node, $grants);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1233,7 +1236,10 @@ function _node_access_rebuild_batch_operation(&$context) {
|
|||
// To preserve database integrity, only write grants if the node
|
||||
// loads successfully.
|
||||
if (!empty($node)) {
|
||||
\Drupal::entityManager()->getAccessControlHandler('node')->writeGrants($node);
|
||||
/** @var \Drupal\node\NodeAccessControlHandlerInterface $access_control_handler */
|
||||
$access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
|
||||
$grants = $access_control_handler->acquireGrants($node);
|
||||
\Drupal::service('node.grant_storage')->write($node, $grants);
|
||||
}
|
||||
$context['sandbox']['progress']++;
|
||||
$context['sandbox']['current_node'] = $nid;
|
||||
|
@ -1286,22 +1292,6 @@ function node_modules_installed($modules) {
|
|||
* Implements hook_modules_uninstalled().
|
||||
*/
|
||||
function node_modules_uninstalled($modules) {
|
||||
// Remove module-specific settings from all node types.
|
||||
$config_names = \Drupal::configFactory()->listAll('node.type.');
|
||||
foreach ($config_names as $config_name) {
|
||||
$config = \Drupal::config($config_name);
|
||||
$changed = FALSE;
|
||||
foreach ($modules as $module) {
|
||||
if ($config->get('settings.' . $module)) {
|
||||
$config->clear('settings.' . $module);
|
||||
$changed = TRUE;
|
||||
}
|
||||
}
|
||||
if ($changed) {
|
||||
$config->save();
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether any of the disabled modules implemented hook_node_grants(),
|
||||
// in which case the node access table needs to be rebuilt.
|
||||
foreach ($modules as $module) {
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provide views data for node.module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_views_wizard().
|
||||
*/
|
||||
function node_views_wizard() {
|
||||
// @todo: figure this piece out.
|
||||
if (\Drupal::moduleHandler()->moduleExists('statistics')) {
|
||||
$plugins['node']['available_sorts']['node_counter-totalcount:DESC'] = t('Number of hits');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Access\NodeAddAccessCheck.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Access;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Access\NodePreviewAccessCheck.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Access;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Access\NodeRevisionAccessCheck.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Access;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Cache\NodeAccessGrantsCacheContext.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Cache;
|
||||
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\ConfigTranslation\NodeTypeMapper.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\ConfigTranslation;
|
||||
|
||||
use Drupal\config_translation\ConfigEntityMapper;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\ContextProvider\NodeRouteContext.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\ContextProvider;
|
||||
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Controller\NodeController.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Controller;
|
||||
|
||||
use Drupal\Component\Utility\Xss;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Controller\NodePreviewController.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Controller;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Controller\NodeViewController.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Controller;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Entity\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Entity;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityBase;
|
||||
|
@ -22,6 +17,12 @@ use Drupal\user\UserInterface;
|
|||
* @ContentEntityType(
|
||||
* id = "node",
|
||||
* label = @Translation("Content"),
|
||||
* label_singular = @Translation("content item"),
|
||||
* label_plural = @Translation("content items"),
|
||||
* label_count = @PluralTranslation(
|
||||
* singular = "@count content item",
|
||||
* plural = "@count content items"
|
||||
* ),
|
||||
* bundle_label = @Translation("Content type"),
|
||||
* handlers = {
|
||||
* "storage" = "Drupal\node\NodeStorage",
|
||||
|
@ -131,7 +132,10 @@ class Node extends ContentEntityBase implements NodeInterface {
|
|||
// default revision. There's no need to delete existing records if the node
|
||||
// is new.
|
||||
if ($this->isDefaultRevision()) {
|
||||
\Drupal::entityManager()->getAccessControlHandler('node')->writeGrants($this, $update);
|
||||
/** @var \Drupal\node\NodeAccessControlHandlerInterface $access_control_handler */
|
||||
$access_control_handler = \Drupal::entityManager()->getAccessControlHandler('node');
|
||||
$grants = $access_control_handler->acquireGrants($this);
|
||||
\Drupal::service('node.grant_storage')->write($this, $grants, NULL, $update);
|
||||
}
|
||||
|
||||
// Reindex the node when it is updated. The node is automatically indexed
|
||||
|
@ -322,41 +326,7 @@ class Node extends ContentEntityBase implements NodeInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
$fields['nid'] = BaseFieldDefinition::create('integer')
|
||||
->setLabel(t('Node ID'))
|
||||
->setDescription(t('The node ID.'))
|
||||
->setReadOnly(TRUE)
|
||||
->setSetting('unsigned', TRUE);
|
||||
|
||||
$fields['uuid'] = BaseFieldDefinition::create('uuid')
|
||||
->setLabel(t('UUID'))
|
||||
->setDescription(t('The node UUID.'))
|
||||
->setReadOnly(TRUE);
|
||||
|
||||
$fields['vid'] = BaseFieldDefinition::create('integer')
|
||||
->setLabel(t('Revision ID'))
|
||||
->setDescription(t('The node revision ID.'))
|
||||
->setReadOnly(TRUE)
|
||||
->setSetting('unsigned', TRUE);
|
||||
|
||||
$fields['type'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Type'))
|
||||
->setDescription(t('The node type.'))
|
||||
->setSetting('target_type', 'node_type')
|
||||
->setReadOnly(TRUE);
|
||||
|
||||
$fields['langcode'] = BaseFieldDefinition::create('language')
|
||||
->setLabel(t('Language'))
|
||||
->setDescription(t('The node language code.'))
|
||||
->setTranslatable(TRUE)
|
||||
->setRevisionable(TRUE)
|
||||
->setDisplayOptions('view', array(
|
||||
'type' => 'hidden',
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'language_select',
|
||||
'weight' => 2,
|
||||
));
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
|
||||
$fields['title'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Title'))
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Entity\NodeRouteProvider.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Entity\NodeType.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\EventSubscriber\NodeAdminRouteSubscriber.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\EventSubscriber;
|
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\DeleteMultiple.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\NodeDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\NodePreviewForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\NodeRevisionDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\NodeRevisionRevertForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatter;
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
@ -37,7 +32,7 @@ class NodeRevisionRevertForm extends ConfirmFormBase {
|
|||
/**
|
||||
* The date formatter service.
|
||||
*
|
||||
* @var \Drupal\Core\Datetime\DateFormatter
|
||||
* @var \Drupal\Core\Datetime\DateFormatterInterface
|
||||
*/
|
||||
protected $dateFormatter;
|
||||
|
||||
|
@ -46,10 +41,10 @@ class NodeRevisionRevertForm extends ConfirmFormBase {
|
|||
*
|
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $node_storage
|
||||
* The node storage.
|
||||
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
|
||||
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
|
||||
* The date formatter service.
|
||||
*/
|
||||
public function __construct(EntityStorageInterface $node_storage, DateFormatter $date_formatter) {
|
||||
public function __construct(EntityStorageInterface $node_storage, DateFormatterInterface $date_formatter) {
|
||||
$this->nodeStorage = $node_storage;
|
||||
$this->dateFormatter = $date_formatter;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\NodeRevisionRevertTranslationForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatter;
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageManagerInterface;
|
||||
|
@ -38,12 +33,12 @@ class NodeRevisionRevertTranslationForm extends NodeRevisionRevertForm {
|
|||
*
|
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $node_storage
|
||||
* The node storage.
|
||||
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
|
||||
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
|
||||
* The date formatter service.
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
*/
|
||||
public function __construct(EntityStorageInterface $node_storage, DateFormatter $date_formatter, LanguageManagerInterface $language_manager) {
|
||||
public function __construct(EntityStorageInterface $node_storage, DateFormatterInterface $date_formatter, LanguageManagerInterface $language_manager) {
|
||||
parent::__construct($node_storage, $date_formatter);
|
||||
$this->languageManager = $language_manager;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\NodeTypeDeleteConfirm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Entity\Query\QueryFactory;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Form\RebuildPermissionsForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Form;
|
||||
|
||||
use Drupal\Core\Form\ConfirmFormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeAccessControlHandler.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
@ -105,7 +100,7 @@ class NodeAccessControlHandler extends EntityAccessControlHandler implements Nod
|
|||
|
||||
// Check if authors can view their own unpublished nodes.
|
||||
if ($operation === 'view' && !$status && $account->hasPermission('view own unpublished content') && $account->isAuthenticated() && $account->id() == $uid) {
|
||||
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->cacheUntilEntityChanges($node);
|
||||
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
|
||||
}
|
||||
|
||||
// Evaluate node grants.
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeAccessControlHandlerInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
|
@ -35,13 +31,11 @@ interface NodeAccessControlHandlerInterface {
|
|||
/**
|
||||
* Writes a list of grants to the database, deleting any previously saved ones.
|
||||
*
|
||||
* If a realm is provided, it will only delete grants from that realm, but it
|
||||
* will always delete a grant from the 'all' realm. Modules that use node
|
||||
* access can use this function when doing mass updates due to widespread
|
||||
* permission changes.
|
||||
* Modules that use node access can use this function when doing mass updates
|
||||
* due to widespread permission changes.
|
||||
*
|
||||
* Note: Don't call this function directly from a contributed module. Call
|
||||
* node_access_acquire_grants() instead.
|
||||
* \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants() instead.
|
||||
*
|
||||
* @param \Drupal\node\NodeInterface $node
|
||||
* The node whose grants are being written.
|
||||
|
@ -49,6 +43,9 @@ interface NodeAccessControlHandlerInterface {
|
|||
* (optional) If false, does not delete records. This is only for optimization
|
||||
* purposes, and assumes the caller has already performed a mass delete of
|
||||
* some form. Defaults to TRUE.
|
||||
*
|
||||
* @deprecated in Drupal 8.x, will be removed before Drupal 9.0.
|
||||
* Use \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants().
|
||||
*/
|
||||
public function writeGrants(NodeInterface $node, $delete = TRUE);
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeGrantDatabaseStorage.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
@ -76,7 +71,7 @@ class NodeGrantDatabaseStorage implements NodeGrantDatabaseStorageInterface {
|
|||
// Return the equivalent of the default grant, defined by
|
||||
// self::writeDefault().
|
||||
if ($operation === 'view') {
|
||||
return AccessResult::allowedIf($node->isPublished())->cacheUntilEntityChanges($node);
|
||||
return AccessResult::allowedIf($node->isPublished())->addCacheableDependency($node);
|
||||
}
|
||||
else {
|
||||
return AccessResult::neutral();
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeGrantDatabaseStorageInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
|
@ -61,7 +56,7 @@ interface NodeGrantDatabaseStorageInterface {
|
|||
* permission changes.
|
||||
*
|
||||
* Note: Don't call this method directly from a contributed module. Call
|
||||
* node_access_write_grants() instead.
|
||||
* \Drupal\node\NodeAccessControlHandlerInterface::acquireGrants() instead.
|
||||
*
|
||||
* @param \Drupal\node\NodeInterface $node
|
||||
* The node whose grants are being written.
|
||||
|
@ -78,9 +73,6 @@ interface NodeGrantDatabaseStorageInterface {
|
|||
* (optional) If false, does not delete records. This is only for optimization
|
||||
* purposes, and assumes the caller has already performed a mass delete of
|
||||
* some form. Defaults to TRUE.
|
||||
*
|
||||
* @see node_access_write_grants()
|
||||
* @see node_access_acquire_grants()
|
||||
*/
|
||||
public function write(NodeInterface $node, array $grants, $realm = NULL, $delete = TRUE);
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\user\EntityOwnerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeListBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodePermissions.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeStorage.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeStorageInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityStorageInterface;
|
||||
|
@ -66,7 +61,7 @@ interface NodeStorageInterface extends ContentEntityStorageInterface {
|
|||
* Unsets the language for all nodes with the given language.
|
||||
*
|
||||
* @param \Drupal\Core\Language\LanguageInterface $language
|
||||
* The language object.
|
||||
* The language object.
|
||||
*/
|
||||
public function clearRevisionsLanguage(LanguageInterface $language);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeStorageSchema.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityTypeInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeTranslationHandler.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\content_translation\ContentTranslationHandler;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeTypeAccessControlHandler.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
@ -30,10 +25,10 @@ class NodeTypeAccessControlHandler extends EntityAccessControlHandler {
|
|||
|
||||
case 'delete':
|
||||
if ($entity->isLocked()) {
|
||||
return AccessResult::forbidden()->cacheUntilEntityChanges($entity);
|
||||
return AccessResult::forbidden()->addCacheableDependency($entity);
|
||||
}
|
||||
else {
|
||||
return parent::checkAccess($entity, $operation, $account)->cacheUntilEntityChanges($entity);
|
||||
return parent::checkAccess($entity, $operation, $account)->addCacheableDependency($entity);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeTypeForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Entity\BundleEntityFormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeTypeInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeTypeListBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeViewBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\NodeViewsData.
|
||||
*/
|
||||
|
||||
namespace Drupal\node;
|
||||
|
||||
use Drupal\views\EntityViewsData;
|
||||
|
@ -37,43 +32,43 @@ class NodeViewsData extends EntityViewsData {
|
|||
|
||||
$data['node_field_data']['type']['argument']['id'] = 'node_type';
|
||||
|
||||
$data['node_field_data']['langcode']['help'] = t('The language of the content or translation.');
|
||||
$data['node_field_data']['langcode']['help'] = $this->t('The language of the content or translation.');
|
||||
|
||||
$data['node_field_data']['status']['filter']['label'] = t('Published status');
|
||||
$data['node_field_data']['status']['filter']['label'] = $this->t('Published status');
|
||||
$data['node_field_data']['status']['filter']['type'] = 'yes-no';
|
||||
// Use status = 1 instead of status <> 0 in WHERE statement.
|
||||
$data['node_field_data']['status']['filter']['use_equal'] = TRUE;
|
||||
|
||||
$data['node_field_data']['status_extra'] = array(
|
||||
'title' => t('Published status or admin user'),
|
||||
'help' => t('Filters out unpublished content if the current user cannot view it.'),
|
||||
'title' => $this->t('Published status or admin user'),
|
||||
'help' => $this->t('Filters out unpublished content if the current user cannot view it.'),
|
||||
'filter' => array(
|
||||
'field' => 'status',
|
||||
'id' => 'node_status',
|
||||
'label' => t('Published status or admin user'),
|
||||
'label' => $this->t('Published status or admin user'),
|
||||
),
|
||||
);
|
||||
|
||||
$data['node_field_data']['promote']['help'] = t('A boolean indicating whether the node is visible on the front page.');
|
||||
$data['node_field_data']['promote']['filter']['label'] = t('Promoted to front page status');
|
||||
$data['node_field_data']['promote']['help'] = $this->t('A boolean indicating whether the node is visible on the front page.');
|
||||
$data['node_field_data']['promote']['filter']['label'] = $this->t('Promoted to front page status');
|
||||
$data['node_field_data']['promote']['filter']['type'] = 'yes-no';
|
||||
|
||||
$data['node_field_data']['sticky']['help'] = t('A boolean indicating whether the node should sort to the top of content lists.');
|
||||
$data['node_field_data']['sticky']['filter']['label'] = t('Sticky status');
|
||||
$data['node_field_data']['sticky']['help'] = $this->t('A boolean indicating whether the node should sort to the top of content lists.');
|
||||
$data['node_field_data']['sticky']['filter']['label'] = $this->t('Sticky status');
|
||||
$data['node_field_data']['sticky']['filter']['type'] = 'yes-no';
|
||||
$data['node_field_data']['sticky']['sort']['help'] = t('Whether or not the content is sticky. To list sticky content first, set this to descending.');
|
||||
$data['node_field_data']['sticky']['sort']['help'] = $this->t('Whether or not the content is sticky. To list sticky content first, set this to descending.');
|
||||
|
||||
$data['node']['path'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Path'),
|
||||
'help' => t('The aliased path to this content.'),
|
||||
'title' => $this->t('Path'),
|
||||
'help' => $this->t('The aliased path to this content.'),
|
||||
'id' => 'node_path',
|
||||
),
|
||||
);
|
||||
|
||||
$data['node']['node_bulk_form'] = array(
|
||||
'title' => t('Node operations bulk form'),
|
||||
'help' => t('Add a form element that lets you run operations on multiple nodes.'),
|
||||
'title' => $this->t('Node operations bulk form'),
|
||||
'help' => $this->t('Add a form element that lets you run operations on multiple nodes.'),
|
||||
'field' => array(
|
||||
'id' => 'node_bulk_form',
|
||||
),
|
||||
|
@ -84,8 +79,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
// @todo Add similar support to any date field
|
||||
// @see https://www.drupal.org/node/2337507
|
||||
$data['node_field_data']['created_fulldate'] = array(
|
||||
'title' => t('Created date'),
|
||||
'help' => t('Date in the form of CCYYMMDD.'),
|
||||
'title' => $this->t('Created date'),
|
||||
'help' => $this->t('Date in the form of CCYYMMDD.'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_fulldate',
|
||||
|
@ -93,8 +88,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['created_year_month'] = array(
|
||||
'title' => t('Created year + month'),
|
||||
'help' => t('Date in the form of YYYYMM.'),
|
||||
'title' => $this->t('Created year + month'),
|
||||
'help' => $this->t('Date in the form of YYYYMM.'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_year_month',
|
||||
|
@ -102,8 +97,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['created_year'] = array(
|
||||
'title' => t('Created year'),
|
||||
'help' => t('Date in the form of YYYY.'),
|
||||
'title' => $this->t('Created year'),
|
||||
'help' => $this->t('Date in the form of YYYY.'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_year',
|
||||
|
@ -111,8 +106,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['created_month'] = array(
|
||||
'title' => t('Created month'),
|
||||
'help' => t('Date in the form of MM (01 - 12).'),
|
||||
'title' => $this->t('Created month'),
|
||||
'help' => $this->t('Date in the form of MM (01 - 12).'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_month',
|
||||
|
@ -120,8 +115,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['created_day'] = array(
|
||||
'title' => t('Created day'),
|
||||
'help' => t('Date in the form of DD (01 - 31).'),
|
||||
'title' => $this->t('Created day'),
|
||||
'help' => $this->t('Date in the form of DD (01 - 31).'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_day',
|
||||
|
@ -129,8 +124,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['created_week'] = array(
|
||||
'title' => t('Created week'),
|
||||
'help' => t('Date in the form of WW (01 - 53).'),
|
||||
'title' => $this->t('Created week'),
|
||||
'help' => $this->t('Date in the form of WW (01 - 53).'),
|
||||
'argument' => array(
|
||||
'field' => 'created',
|
||||
'id' => 'date_week',
|
||||
|
@ -138,8 +133,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['changed_fulldate'] = array(
|
||||
'title' => t('Updated date'),
|
||||
'help' => t('Date in the form of CCYYMMDD.'),
|
||||
'title' => $this->t('Updated date'),
|
||||
'help' => $this->t('Date in the form of CCYYMMDD.'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_fulldate',
|
||||
|
@ -147,8 +142,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['changed_year_month'] = array(
|
||||
'title' => t('Updated year + month'),
|
||||
'help' => t('Date in the form of YYYYMM.'),
|
||||
'title' => $this->t('Updated year + month'),
|
||||
'help' => $this->t('Date in the form of YYYYMM.'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_year_month',
|
||||
|
@ -156,8 +151,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['changed_year'] = array(
|
||||
'title' => t('Updated year'),
|
||||
'help' => t('Date in the form of YYYY.'),
|
||||
'title' => $this->t('Updated year'),
|
||||
'help' => $this->t('Date in the form of YYYY.'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_year',
|
||||
|
@ -165,8 +160,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['changed_month'] = array(
|
||||
'title' => t('Updated month'),
|
||||
'help' => t('Date in the form of MM (01 - 12).'),
|
||||
'title' => $this->t('Updated month'),
|
||||
'help' => $this->t('Date in the form of MM (01 - 12).'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_month',
|
||||
|
@ -174,8 +169,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['changed_day'] = array(
|
||||
'title' => t('Updated day'),
|
||||
'help' => t('Date in the form of DD (01 - 31).'),
|
||||
'title' => $this->t('Updated day'),
|
||||
'help' => $this->t('Date in the form of DD (01 - 31).'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_day',
|
||||
|
@ -183,30 +178,30 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_field_data']['changed_week'] = array(
|
||||
'title' => t('Updated week'),
|
||||
'help' => t('Date in the form of WW (01 - 53).'),
|
||||
'title' => $this->t('Updated week'),
|
||||
'help' => $this->t('Date in the form of WW (01 - 53).'),
|
||||
'argument' => array(
|
||||
'field' => 'changed',
|
||||
'id' => 'date_week',
|
||||
),
|
||||
);
|
||||
|
||||
$data['node_field_data']['uid']['help'] = t('The user authoring the content. If you need more fields than the uid add the content: author relationship');
|
||||
$data['node_field_data']['uid']['help'] = $this->t('The user authoring the content. If you need more fields than the uid add the content: author relationship');
|
||||
$data['node_field_data']['uid']['filter']['id'] = 'user_name';
|
||||
$data['node_field_data']['uid']['relationship']['title'] = t('Content author');
|
||||
$data['node_field_data']['uid']['relationship']['help'] = t('Relate content to the user who created it.');
|
||||
$data['node_field_data']['uid']['relationship']['label'] = t('author');
|
||||
$data['node_field_data']['uid']['relationship']['title'] = $this->t('Content author');
|
||||
$data['node_field_data']['uid']['relationship']['help'] = $this->t('Relate content to the user who created it.');
|
||||
$data['node_field_data']['uid']['relationship']['label'] = $this->t('author');
|
||||
|
||||
$data['node']['node_listing_empty'] = array(
|
||||
'title' => t('Empty Node Frontpage behavior'),
|
||||
'help' => t('Provides a link to the node add overview page.'),
|
||||
'title' => $this->t('Empty Node Frontpage behavior'),
|
||||
'help' => $this->t('Provides a link to the node add overview page.'),
|
||||
'area' => array(
|
||||
'id' => 'node_listing_empty',
|
||||
),
|
||||
);
|
||||
|
||||
$data['node_field_data']['uid_revision']['title'] = t('User has a revision');
|
||||
$data['node_field_data']['uid_revision']['help'] = t('All nodes where a certain user has a revision');
|
||||
$data['node_field_data']['uid_revision']['title'] = $this->t('User has a revision');
|
||||
$data['node_field_data']['uid_revision']['help'] = $this->t('All nodes where a certain user has a revision');
|
||||
$data['node_field_data']['uid_revision']['real field'] = 'nid';
|
||||
$data['node_field_data']['uid_revision']['filter']['id'] = 'node_uid_revision';
|
||||
$data['node_field_data']['uid_revision']['argument']['id'] = 'node_uid_revision';
|
||||
|
@ -214,7 +209,7 @@ class NodeViewsData extends EntityViewsData {
|
|||
$data['node_field_revision']['table']['wizard_id'] = 'node_revision';
|
||||
|
||||
// Advertise this table as a possible base table.
|
||||
$data['node_field_revision']['table']['base']['help'] = t('Content revision is a history of changes to content.');
|
||||
$data['node_field_revision']['table']['base']['help'] = $this->t('Content revision is a history of changes to content.');
|
||||
$data['node_field_revision']['table']['base']['defaults']['title'] = 'title';
|
||||
|
||||
$data['node_field_revision']['nid']['argument'] = [
|
||||
|
@ -227,8 +222,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
$data['node_field_revision']['nid']['relationship']['id'] = 'standard';
|
||||
$data['node_field_revision']['nid']['relationship']['base'] = 'node_field_data';
|
||||
$data['node_field_revision']['nid']['relationship']['base field'] = 'nid';
|
||||
$data['node_field_revision']['nid']['relationship']['title'] = t('Content');
|
||||
$data['node_field_revision']['nid']['relationship']['label'] = t('Get the actual content from a content revision.');
|
||||
$data['node_field_revision']['nid']['relationship']['title'] = $this->t('Content');
|
||||
$data['node_field_revision']['nid']['relationship']['label'] = $this->t('Get the actual content from a content revision.');
|
||||
|
||||
$data['node_field_revision']['vid'] = array(
|
||||
'argument' => array(
|
||||
|
@ -239,35 +234,35 @@ class NodeViewsData extends EntityViewsData {
|
|||
'id' => 'standard',
|
||||
'base' => 'node_field_data',
|
||||
'base field' => 'vid',
|
||||
'title' => t('Content'),
|
||||
'label' => t('Get the actual content from a content revision.'),
|
||||
'title' => $this->t('Content'),
|
||||
'label' => $this->t('Get the actual content from a content revision.'),
|
||||
),
|
||||
) + $data['node_field_revision']['vid'];
|
||||
|
||||
$data['node_field_revision']['langcode']['help'] = t('The language the original content is in.');
|
||||
$data['node_field_revision']['langcode']['help'] = $this->t('The language the original content is in.');
|
||||
|
||||
$data['node_revision']['revision_uid']['help'] = t('Relate a content revision to the user who created the revision.');
|
||||
$data['node_revision']['revision_uid']['relationship']['label'] = t('revision user');
|
||||
$data['node_revision']['revision_uid']['help'] = $this->t('Relate a content revision to the user who created the revision.');
|
||||
$data['node_revision']['revision_uid']['relationship']['label'] = $this->t('revision user');
|
||||
|
||||
$data['node_field_revision']['table']['wizard_id'] = 'node_field_revision';
|
||||
|
||||
$data['node_field_revision']['table']['join']['node_field_data']['left_field'] = 'vid';
|
||||
$data['node_field_revision']['table']['join']['node_field_data']['field'] = 'vid';
|
||||
|
||||
$data['node_field_revision']['status']['filter']['label'] = t('Published');
|
||||
$data['node_field_revision']['status']['filter']['label'] = $this->t('Published');
|
||||
$data['node_field_revision']['status']['filter']['type'] = 'yes-no';
|
||||
$data['node_field_revision']['status']['filter']['use_equal'] = TRUE;
|
||||
|
||||
$data['node_field_revision']['promote']['help'] = t('A boolean indicating whether the node is visible on the front page.');
|
||||
$data['node_field_revision']['promote']['help'] = $this->t('A boolean indicating whether the node is visible on the front page.');
|
||||
|
||||
$data['node_field_revision']['sticky']['help'] = t('A boolean indicating whether the node should sort to the top of content lists.');
|
||||
$data['node_field_revision']['sticky']['help'] = $this->t('A boolean indicating whether the node should sort to the top of content lists.');
|
||||
|
||||
$data['node_field_revision']['langcode']['help'] = t('The language of the content or translation.');
|
||||
$data['node_field_revision']['langcode']['help'] = $this->t('The language of the content or translation.');
|
||||
|
||||
$data['node_field_revision']['link_to_revision'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link to revision'),
|
||||
'help' => t('Provide a simple link to the revision.'),
|
||||
'title' => $this->t('Link to revision'),
|
||||
'help' => $this->t('Provide a simple link to the revision.'),
|
||||
'id' => 'node_revision_link',
|
||||
'click sortable' => FALSE,
|
||||
),
|
||||
|
@ -275,8 +270,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
|
||||
$data['node_field_revision']['revert_revision'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link to revert revision'),
|
||||
'help' => t('Provide a simple link to revert to the revision.'),
|
||||
'title' => $this->t('Link to revert revision'),
|
||||
'help' => $this->t('Provide a simple link to revert to the revision.'),
|
||||
'id' => 'node_revision_link_revert',
|
||||
'click sortable' => FALSE,
|
||||
),
|
||||
|
@ -284,8 +279,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
|
||||
$data['node_field_revision']['delete_revision'] = array(
|
||||
'field' => array(
|
||||
'title' => t('Link to delete revision'),
|
||||
'help' => t('Provide a simple link to delete the content revision.'),
|
||||
'title' => $this->t('Link to delete revision'),
|
||||
'help' => $this->t('Provide a simple link to delete the content revision.'),
|
||||
'id' => 'node_revision_link_delete',
|
||||
'click sortable' => FALSE,
|
||||
),
|
||||
|
@ -293,7 +288,7 @@ class NodeViewsData extends EntityViewsData {
|
|||
|
||||
// Define the base group of this table. Fields that don't have a group defined
|
||||
// will go into this field by default.
|
||||
$data['node_access']['table']['group'] = t('Content access');
|
||||
$data['node_access']['table']['group'] = $this->t('Content access');
|
||||
|
||||
// For other base tables, explain how we join.
|
||||
$data['node_access']['table']['join'] = array(
|
||||
|
@ -303,11 +298,11 @@ class NodeViewsData extends EntityViewsData {
|
|||
),
|
||||
);
|
||||
$data['node_access']['nid'] = array(
|
||||
'title' => t('Access'),
|
||||
'help' => t('Filter by access.'),
|
||||
'title' => $this->t('Access'),
|
||||
'help' => $this->t('Filter by access.'),
|
||||
'filter' => array(
|
||||
'id' => 'node_access',
|
||||
'help' => t('Filter for content by view access. <strong>Not necessary if you are using node as your base table.</strong>'),
|
||||
'help' => $this->t('Filter for content by view access. <strong>Not necessary if you are using node as your base table.</strong>'),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -324,7 +319,7 @@ class NodeViewsData extends EntityViewsData {
|
|||
}
|
||||
|
||||
if ($enabled) {
|
||||
$data['node_search_index']['table']['group'] = t('Search');
|
||||
$data['node_search_index']['table']['group'] = $this->t('Search');
|
||||
|
||||
// Automatically join to the node table (or actually, node_field_data).
|
||||
// Use a Views table alias to allow other modules to use this table too,
|
||||
|
@ -357,8 +352,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_search_index']['score'] = array(
|
||||
'title' => t('Score'),
|
||||
'help' => t('The score of the search item. This will not be used if the search filter is not also present.'),
|
||||
'title' => $this->t('Score'),
|
||||
'help' => $this->t('The score of the search item. This will not be used if the search filter is not also present.'),
|
||||
'field' => array(
|
||||
'id' => 'search_score',
|
||||
'float' => TRUE,
|
||||
|
@ -371,8 +366,8 @@ class NodeViewsData extends EntityViewsData {
|
|||
);
|
||||
|
||||
$data['node_search_index']['keys'] = array(
|
||||
'title' => t('Search Keywords'),
|
||||
'help' => t('The keywords to search for.'),
|
||||
'title' => $this->t('Search Keywords'),
|
||||
'help' => $this->t('The keywords to search for.'),
|
||||
'filter' => array(
|
||||
'id' => 'search_keywords',
|
||||
'no group by' => TRUE,
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\PageCache\DenyNodePreview.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\PageCache;
|
||||
|
||||
use Drupal\Core\PageCache\ResponsePolicyInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\ParamConverter\NodePreviewConverter.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\ParamConverter;
|
||||
|
||||
use Drupal\user\PrivateTempStoreFactory;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\AssignOwnerNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ConfigurableActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\DeleteNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\DemoteNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\PromoteNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\PublishNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\SaveNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\StickyNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\UnpublishByKeywordNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Component\Utility\Tags;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\UnpublishNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Action\UnstickyNode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Action;
|
||||
|
||||
use Drupal\Core\Action\ActionBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Block\SyndicateBlock.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Condition\NodeType.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Condition;
|
||||
|
||||
use Drupal\Core\Condition\ConditionPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\EntityReferenceSelection\NodeSelection.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\EntityReferenceSelection;
|
||||
|
||||
use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\Search\NodeSearch.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\Search;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
|
137
core/modules/node/src/Plugin/migrate/D6NodeDeriver.php
Normal file
137
core/modules/node/src/Plugin/migrate/D6NodeDeriver.php
Normal file
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\node\Plugin\migrate;
|
||||
|
||||
use Drupal\Component\Plugin\Derivative\DeriverBase;
|
||||
use Drupal\Component\Plugin\PluginManagerInterface;
|
||||
use Drupal\Core\Database\DatabaseExceptionWrapper;
|
||||
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\migrate\Plugin\MigrationDeriverTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Deriver for Drupal 6 node and node revision migrations based on node types.
|
||||
*/
|
||||
class D6NodeDeriver extends DeriverBase implements ContainerDeriverInterface {
|
||||
use MigrationDeriverTrait;
|
||||
|
||||
/**
|
||||
* The base plugin ID this derivative is for.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $basePluginId;
|
||||
|
||||
/**
|
||||
* Already-instantiated cckfield plugins, keyed by ID.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface[]
|
||||
*/
|
||||
protected $cckPluginCache;
|
||||
|
||||
/**
|
||||
* The CCK plugin manager.
|
||||
*
|
||||
* @var \Drupal\Component\Plugin\PluginManagerInterface
|
||||
*/
|
||||
protected $cckPluginManager;
|
||||
|
||||
/**
|
||||
* D6NodeDeriver constructor.
|
||||
*
|
||||
* @param string $base_plugin_id
|
||||
* The base plugin ID for the plugin ID.
|
||||
* @param \Drupal\Component\Plugin\PluginManagerInterface $cck_manager
|
||||
* The CCK plugin manager.
|
||||
*/
|
||||
public function __construct($base_plugin_id, PluginManagerInterface $cck_manager) {
|
||||
$this->basePluginId = $base_plugin_id;
|
||||
$this->cckPluginManager = $cck_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, $base_plugin_id) {
|
||||
return new static(
|
||||
$base_plugin_id,
|
||||
$container->get('plugin.manager.migrate.cckfield')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the definition of all derivatives of a base plugin.
|
||||
*
|
||||
* @param array $base_plugin_definition
|
||||
* The definition array of the base plugin.
|
||||
*
|
||||
* @return array
|
||||
* An array of full derivative definitions keyed on derivative id.
|
||||
*
|
||||
* @see \Drupal\Component\Plugin\Derivative\DeriverBase::getDerivativeDefinition()
|
||||
*/
|
||||
public function getDerivativeDefinitions($base_plugin_definition) {
|
||||
// Read all CCK field instance definitions in the source database.
|
||||
$fields = array();
|
||||
try {
|
||||
$source_plugin = static::getSourcePlugin('d6_field_instance');
|
||||
$source_plugin->checkRequirements();
|
||||
|
||||
foreach ($source_plugin as $row) {
|
||||
$fields[$row->getSourceProperty('type_name')][$row->getSourceProperty('field_name')] = $row->getSource();
|
||||
}
|
||||
}
|
||||
catch (RequirementsException $e) {
|
||||
// If checkRequirements() failed then the content module did not exist and
|
||||
// we do not have any CCK fields. Therefore, $fields will be empty and
|
||||
// below we'll create a migration just for the node properties.
|
||||
}
|
||||
|
||||
try {
|
||||
foreach (static::getSourcePlugin('d6_node_type') as $row) {
|
||||
$node_type = $row->getSourceProperty('type');
|
||||
$values = $base_plugin_definition;
|
||||
|
||||
$values['label'] = t("@label (@type)", [
|
||||
'@label' => $values['label'],
|
||||
'@type' => $node_type,
|
||||
]);
|
||||
$values['source']['node_type'] = $node_type;
|
||||
|
||||
// If this migration is based on the d6_node_revision migration, it
|
||||
// should explicitly depend on the corresponding d6_node variant.
|
||||
if ($base_plugin_definition['id'] == 'd6_node_revision') {
|
||||
$values['migration_dependencies']['required'][] = 'd6_node:' . $node_type;
|
||||
}
|
||||
|
||||
$migration = \Drupal::service('plugin.manager.migration')->createStubMigration($values);
|
||||
if (isset($fields[$node_type])) {
|
||||
foreach ($fields[$node_type] as $field_name => $info) {
|
||||
$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]
|
||||
->processCckFieldValues($migration, $field_name, $info);
|
||||
}
|
||||
else {
|
||||
$migration->setProcessOfProperty($field_name, $field_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->derivatives[$node_type] = $migration->getPluginDefinition();
|
||||
}
|
||||
}
|
||||
catch (DatabaseExceptionWrapper $e) {
|
||||
// Once we begin iterating the source plugin it is possible that the
|
||||
// source tables will not exist. This can happen when the
|
||||
// MigrationPluginManager gathers up the migration definitions but we do
|
||||
// not actually have a Drupal 6 source database.
|
||||
}
|
||||
|
||||
return $this->derivatives;
|
||||
}
|
||||
|
||||
}
|
125
core/modules/node/src/Plugin/migrate/D7NodeDeriver.php
Normal file
125
core/modules/node/src/Plugin/migrate/D7NodeDeriver.php
Normal file
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\node\Plugin\migrate;
|
||||
|
||||
use Drupal\Component\Plugin\Derivative\DeriverBase;
|
||||
use Drupal\Component\Plugin\PluginManagerInterface;
|
||||
use Drupal\Core\Database\DatabaseExceptionWrapper;
|
||||
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\migrate\Plugin\MigrationDeriverTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Deriver for Drupal 7 node and node revision migrations based on node types.
|
||||
*/
|
||||
class D7NodeDeriver extends DeriverBase implements ContainerDeriverInterface {
|
||||
use MigrationDeriverTrait;
|
||||
|
||||
/**
|
||||
* The base plugin ID this derivative is for.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $basePluginId;
|
||||
|
||||
/**
|
||||
* Already-instantiated cckfield plugins, keyed by ID.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal\Plugin\MigrateCckFieldInterface[]
|
||||
*/
|
||||
protected $cckPluginCache;
|
||||
|
||||
/**
|
||||
* The CCK plugin manager.
|
||||
*
|
||||
* @var \Drupal\Component\Plugin\PluginManagerInterface
|
||||
*/
|
||||
protected $cckPluginManager;
|
||||
|
||||
/**
|
||||
* D7NodeDeriver constructor.
|
||||
*
|
||||
* @param string $base_plugin_id
|
||||
* The base plugin ID for the plugin ID.
|
||||
* @param \Drupal\Component\Plugin\PluginManagerInterface $cck_manager
|
||||
* The CCK plugin manager.
|
||||
*/
|
||||
public function __construct($base_plugin_id, PluginManagerInterface $cck_manager) {
|
||||
$this->basePluginId = $base_plugin_id;
|
||||
$this->cckPluginManager = $cck_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, $base_plugin_id) {
|
||||
return new static(
|
||||
$base_plugin_id,
|
||||
$container->get('plugin.manager.migrate.cckfield')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDerivativeDefinitions($base_plugin_definition) {
|
||||
$fields = [];
|
||||
try {
|
||||
$source_plugin = static::getSourcePlugin('d7_field_instance');
|
||||
$source_plugin->checkRequirements();
|
||||
|
||||
// Read all field instance definitions in the source database.
|
||||
foreach ($source_plugin as $row) {
|
||||
if ($row->getSourceProperty('entity_type') == 'node') {
|
||||
$fields[$row->getSourceProperty('bundle')][$row->getSourceProperty('field_name')] = $row->getSource();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (RequirementsException $e) {
|
||||
// If checkRequirements() failed then the field module did not exist and
|
||||
// we do not have any fields. Therefore, $fields will be empty and below
|
||||
// we'll create a migration just for the node properties.
|
||||
}
|
||||
|
||||
try {
|
||||
foreach (static::getSourcePlugin('d7_node_type') as $row) {
|
||||
$node_type = $row->getSourceProperty('type');
|
||||
$values = $base_plugin_definition;
|
||||
|
||||
$values['label'] = t('@label (@type)', [
|
||||
'@label' => $values['label'],
|
||||
'@type' => $row->getSourceProperty('name'),
|
||||
]);
|
||||
$values['source']['node_type'] = $node_type;
|
||||
|
||||
$migration = \Drupal::service('plugin.manager.migration')->createStubMigration($values);
|
||||
if (isset($fields[$node_type])) {
|
||||
foreach ($fields[$node_type] as $field_name => $info) {
|
||||
$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]
|
||||
->processCckFieldValues($migration, $field_name, $info);
|
||||
}
|
||||
else {
|
||||
$migration->setProcessOfProperty($field_name, $field_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->derivatives[$node_type] = $migration->getPluginDefinition();
|
||||
}
|
||||
}
|
||||
catch (DatabaseExceptionWrapper $e) {
|
||||
// Once we begin iterating the source plugin it is possible that the
|
||||
// source tables will not exist. This can happen when the
|
||||
// MigrationPluginManager gathers up the migration definitions but we do
|
||||
// not actually have a Drupal 7 source database.
|
||||
}
|
||||
|
||||
return $this->derivatives;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\builder\d6\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\builder\d6;
|
||||
|
||||
use Drupal\migrate\Entity\Migration;
|
||||
use Drupal\migrate\Exception\RequirementsException;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\builder\CckBuilder;
|
||||
|
||||
/**
|
||||
* @PluginID("d6_node")
|
||||
*/
|
||||
class Node extends CckBuilder {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildMigrations(array $template) {
|
||||
$migrations = [];
|
||||
|
||||
// Read all CCK field instance definitions in the source database.
|
||||
$fields = array();
|
||||
$source_plugin = $this->getSourcePlugin('d6_field_instance', $template['source']);
|
||||
try {
|
||||
$source_plugin->checkRequirements();
|
||||
|
||||
foreach ($source_plugin as $field) {
|
||||
$info = $field->getSource();
|
||||
$fields[$info['type_name']][$info['field_name']] = $info;
|
||||
}
|
||||
}
|
||||
catch (RequirementsException $e) {
|
||||
// Don't do anything; $fields will be empty.
|
||||
}
|
||||
|
||||
foreach ($this->getSourcePlugin('d6_node_type', $template['source']) as $row) {
|
||||
$node_type = $row->getSourceProperty('type');
|
||||
$values = $template;
|
||||
$values['id'] = $template['id'] . '__' . $node_type;
|
||||
|
||||
$label = $template['label'];
|
||||
$values['label'] = $this->t("@label (@type)", ['@label' => $label, '@type' => $node_type]);
|
||||
$values['source']['node_type'] = $node_type;
|
||||
|
||||
// If this migration is based on the d6_node_revision template, it should
|
||||
// explicitly depend on the corresponding d6_node variant.
|
||||
if ($template['id'] == 'd6_node_revision') {
|
||||
$values['migration_dependencies']['required'][] = 'd6_node__' . $node_type;
|
||||
}
|
||||
|
||||
$migration = Migration::create($values);
|
||||
|
||||
if (isset($fields[$node_type])) {
|
||||
foreach ($fields[$node_type] as $field => $info) {
|
||||
if ($this->cckPluginManager->hasDefinition($info['type'])) {
|
||||
$this->getCckPlugin($info['type'])
|
||||
->processCckFieldValues($migration, $field, $info);
|
||||
}
|
||||
else {
|
||||
$migration->setProcessOfProperty($field, $field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$migrations[] = $migration;
|
||||
}
|
||||
|
||||
return $migrations;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\builder\d7\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\builder\d7;
|
||||
|
||||
use Drupal\migrate\Entity\Migration;
|
||||
use Drupal\migrate_drupal\Plugin\migrate\builder\CckBuilder;
|
||||
|
||||
/**
|
||||
* @PluginID("d7_node")
|
||||
*/
|
||||
class Node extends CckBuilder {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildMigrations(array $template) {
|
||||
$migrations = [];
|
||||
|
||||
// Read all field instance definitions in the source database.
|
||||
$fields = array();
|
||||
foreach ($this->getSourcePlugin('d7_field_instance', $template['source']) as $field) {
|
||||
$info = $field->getSource();
|
||||
$fields[$info['entity_type']][$info['bundle']][$info['field_name']] = $info;
|
||||
}
|
||||
|
||||
foreach ($this->getSourcePlugin('d7_node_type', $template['source']) as $node_type) {
|
||||
$bundle = $node_type->getSourceProperty('type');
|
||||
$values = $template;
|
||||
$values['id'] .= '__' . $bundle;
|
||||
$values['label'] = $this->t('@label (@type)', ['@label' => $values['label'], '@type' => $node_type->getSourceProperty('name')]);
|
||||
$values['source']['node_type'] = $bundle;
|
||||
$migration = Migration::create($values);
|
||||
|
||||
if (isset($fields['node'][$bundle])) {
|
||||
foreach ($fields['node'][$bundle] as $field => $data) {
|
||||
if ($this->cckPluginManager->hasDefinition($data['type'])) {
|
||||
$this->getCckPlugin($data['type'])
|
||||
->processCckFieldValues($migration, $field, $data);
|
||||
}
|
||||
else {
|
||||
$migration->setProcessOfProperty($field, $field);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$migrations[] = $migration;
|
||||
}
|
||||
|
||||
return $migrations;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\destination\EntityNodeType.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\destination;
|
||||
|
||||
use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\process\d6\NodeUpdate7008.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d6\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d6\NodeRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d6;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d6\NodeType.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d6\ViewMode.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d6;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d6\ViewModeBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d7\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d7\NodeRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d7;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\migrate\source\d7\NodeType.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\migrate\source\d7;
|
||||
|
||||
use Drupal\migrate\Row;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\area\ListingEmpty.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\area;
|
||||
|
||||
use Drupal\Core\Access\AccessManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\argument\Nid.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\argument;
|
||||
|
||||
use Drupal\node\NodeStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\argument\Type.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\argument;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\argument\UidRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\argument;
|
||||
|
||||
use Drupal\user\Plugin\views\argument\Uid;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\argument\Vid.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\argument;
|
||||
|
||||
use Drupal\Core\Database\Connection;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\argument_default\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\argument_default;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\field\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\field\NodeBulkForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\field;
|
||||
|
||||
use Drupal\system\Plugin\views\field\BulkForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\field\Path.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\field\RevisionLink.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\field\RevisionLinkDelete.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\field\RevisionLinkRevert.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\field;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\filter\Access.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\filter;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\filter\Status.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\filter;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\filter\UidRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\filter;
|
||||
|
||||
use Drupal\user\Plugin\views\filter\Name;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\row\NodeRow.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\row;
|
||||
|
||||
use Drupal\views\Plugin\views\row\EntityRow;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\row\Rss.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\row;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\wizard\Node.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\wizard;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Plugin\views\wizard\NodeRevision.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Plugin\views\wizard;
|
||||
|
||||
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue