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
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\ProxyClass\ParamConverter\NodePreviewConverter.
|
||||
*/
|
||||
// @codingStandardsIgnoreFile
|
||||
|
||||
/**
|
||||
* This file was generated via php core/scripts/generate-proxy-class.php 'Drupal\node\ParamConverter\NodePreviewConverter' "core/modules/node/src".
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Routing\RouteSubscriber.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Routing;
|
||||
|
||||
use Drupal\Core\Routing\RouteSubscriberBase;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\AssertButtonsTrait.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Condition\NodeConditionTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Condition;
|
||||
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\system\Tests\Entity\EntityUnitTestBase;
|
||||
|
||||
/**
|
||||
|
|
@ -22,11 +19,11 @@ class NodeConditionTest extends EntityUnitTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Create the node bundles required for testing.
|
||||
$type = entity_create('node_type', array('type' => 'page', 'name' => 'page'));
|
||||
$type = NodeType::create(['type' => 'page', 'name' => 'page']);
|
||||
$type->save();
|
||||
$type = entity_create('node_type', array('type' => 'article', 'name' => 'article'));
|
||||
$type = NodeType::create(['type' => 'article', 'name' => 'article']);
|
||||
$type->save();
|
||||
$type = entity_create('node_type', array('type' => 'test', 'name' => 'test'));
|
||||
$type = NodeType::create(['type' => 'test', 'name' => 'test']);
|
||||
$type->save();
|
||||
}
|
||||
|
||||
|
|
@ -38,11 +35,11 @@ class NodeConditionTest extends EntityUnitTestBase {
|
|||
$this->createUser();
|
||||
|
||||
// Get some nodes of various types to check against.
|
||||
$page = entity_create('node', array('type' => 'page', 'title' => $this->randomMachineName(), 'uid' => 1));
|
||||
$page = Node::create(['type' => 'page', 'title' => $this->randomMachineName(), 'uid' => 1]);
|
||||
$page->save();
|
||||
$article = entity_create('node', array('type' => 'article', 'title' => $this->randomMachineName(), 'uid' => 1));
|
||||
$article = Node::create(['type' => 'article', 'title' => $this->randomMachineName(), 'uid' => 1]);
|
||||
$article->save();
|
||||
$test = entity_create('node', array('type' => 'test', 'title' => $this->randomMachineName(), 'uid' => 1));
|
||||
$test = Node::create(['type' => 'test', 'title' => $this->randomMachineName(), 'uid' => 1]);
|
||||
$test->save();
|
||||
|
||||
// Grab the node type condition and configure it to check against node type
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Config\NodeImportChangeTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Config;
|
||||
|
||||
use Drupal\node\Entity\NodeType;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Config\NodeImportCreateTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Config;
|
||||
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Migrate\MigrateNodeStubTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Migrate;
|
||||
|
||||
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
|
||||
use Drupal\migrate_drupal\Tests\StubTestTrait;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
|
||||
/**
|
||||
* Test stub creation for nodes.
|
||||
*
|
||||
* @group node
|
||||
*/
|
||||
class MigrateNodeStubTest extends MigrateDrupalTestBase {
|
||||
|
||||
use StubTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['node'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('node');
|
||||
// Need at least one node type present.
|
||||
NodeType::create([
|
||||
'type' => 'testnodetype',
|
||||
'name' => 'Test node type',
|
||||
])->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creation of node stubs.
|
||||
*/
|
||||
public function testStub() {
|
||||
$this->performStubTest('node');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Migrate\d6\MigrateNodeBuilderTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\migrate\Entity\Migration;
|
||||
|
||||
/**
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateNodeBuilderTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* @var MigrationInterface[]
|
||||
*/
|
||||
protected $builtMigrations = [];
|
||||
|
||||
/**
|
||||
* Asserts various aspects of a migration entity.
|
||||
*
|
||||
* @param string $id
|
||||
* The migration ID.
|
||||
* @param string $label
|
||||
* The label.
|
||||
*/
|
||||
protected function assertEntity($id, $label) {
|
||||
$migration = $this->builtMigrations[$id];
|
||||
$this->assertTrue($migration instanceof Migration);
|
||||
$this->assertIdentical($id, $migration->id());
|
||||
$this->assertEqual($label, $migration->label());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creating migrations from a template, using a builder plugin.
|
||||
*/
|
||||
public function testCreateMigrations() {
|
||||
$templates = [
|
||||
'd6_node' => [
|
||||
'id' => 'd6_node',
|
||||
'label' => 'Drupal 6 nodes',
|
||||
'builder' => [
|
||||
'plugin' => 'd6_node',
|
||||
],
|
||||
'source' => [
|
||||
'plugin' => 'd6_node',
|
||||
],
|
||||
'process' => [
|
||||
'nid' => 'nid',
|
||||
'vid' => 'vid',
|
||||
'uid' => 'uid',
|
||||
],
|
||||
'destination' => [
|
||||
'plugin' => 'entity:node',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$migrations = \Drupal::service('migrate.migration_builder')->createMigrations($templates);
|
||||
// Key the array.
|
||||
foreach ($migrations as $migration) {
|
||||
$this->builtMigrations[$migration->id()] = $migration;
|
||||
}
|
||||
$this->assertIdentical(11, count($this->builtMigrations));
|
||||
$this->assertEntity('d6_node__article', 'Drupal 6 nodes (article)');
|
||||
$this->assertEntity('d6_node__company', 'Drupal 6 nodes (company)');
|
||||
$this->assertEntity('d6_node__employee', 'Drupal 6 nodes (employee)');
|
||||
$this->assertEntity('d6_node__event', 'Drupal 6 nodes (event)');
|
||||
$this->assertEntity('d6_node__page', 'Drupal 6 nodes (page)');
|
||||
$this->assertEntity('d6_node__sponsor', 'Drupal 6 nodes (sponsor)');
|
||||
$this->assertEntity('d6_node__story', 'Drupal 6 nodes (story)');
|
||||
$this->assertEntity('d6_node__test_event', 'Drupal 6 nodes (test_event)');
|
||||
$this->assertEntity('d6_node__test_page', 'Drupal 6 nodes (test_page)');
|
||||
$this->assertEntity('d6_node__test_planet', 'Drupal 6 nodes (test_planet)');
|
||||
$this->assertEntity('d6_node__test_story', 'Drupal 6 nodes (test_story)');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Migrate\d6\MigrateNodeBundleSettingsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\Core\Field\Entity\BaseFieldOverride;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
|
||||
/**
|
||||
* Test migrating node settings into the base_field_bundle_override config entity.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateNodeBundleSettingsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['node']);
|
||||
$this->executeMigration('d6_node_type');
|
||||
|
||||
// Create a config entity that already exists.
|
||||
BaseFieldOverride::create([
|
||||
'field_name' => 'promote',
|
||||
'entity_type' => 'node',
|
||||
'bundle' => 'page',
|
||||
])->save();
|
||||
|
||||
$this->executeMigrations([
|
||||
'd6_node_setting_promote',
|
||||
'd6_node_setting_status',
|
||||
'd6_node_setting_sticky'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Drupal 6 node type settings to Drupal 8 migration.
|
||||
*/
|
||||
public function testNodeBundleSettings() {
|
||||
// Test settings on test_page bundle.
|
||||
$node = Node::create(['type' => 'test_page']);
|
||||
$this->assertIdentical(1, $node->status->value);
|
||||
$this->assertIdentical(1, $node->promote->value);
|
||||
$this->assertIdentical(1, $node->sticky->value);
|
||||
|
||||
// Test settings for test_story bundle.
|
||||
$node = Node::create(['type' => 'test_story']);
|
||||
$this->assertIdentical(1, $node->status->value);
|
||||
$this->assertIdentical(1, $node->promote->value);
|
||||
$this->assertIdentical(0, $node->sticky->value);
|
||||
|
||||
// Test settings for the test_event bundle.
|
||||
$node = Node::create(['type' => 'test_event']);
|
||||
$this->assertIdentical(0, $node->status->value);
|
||||
$this->assertIdentical(0, $node->promote->value);
|
||||
$this->assertIdentical(1, $node->sticky->value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Migrate\d6\MigrateNodeConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to node.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateNodeConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d6_node_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests Drupal 6 node settings to Drupal 8 migration.
|
||||
*/
|
||||
public function testNodeSettings() {
|
||||
$config = $this->config('node.settings');
|
||||
$this->assertIdentical(FALSE, $config->get('use_admin_theme'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'node.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Migrate\d6\MigrateNodeRevisionTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Migrate\d6;
|
||||
use Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeTestBase;
|
||||
|
||||
/**
|
||||
* Node content revisions migration.
|
||||
|
|
@ -19,7 +15,7 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase {
|
|||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigrations(['d6_node:*', 'd6_node_revision:*']);
|
||||
$this->executeMigrations(['d6_node', 'd6_node_revision']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\node\Tests\Migrate\d6\MigrateNodeSettingPromoteTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\node\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\Core\Field\Entity\BaseFieldOverride;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateNodeSettingPromoteTest extends MigrateDrupal6TestBase {
|
||||
|
||||
public static $modules = ['node', 'text'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(['node']);
|
||||
$this->executeMigration('d6_node_type');
|
||||
$this->executeMigration('d6_node_setting_promote');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of the promote checkbox's settings.
|
||||
*/
|
||||
public function testMigration() {
|
||||
$this->assertIdentical('Promoted to front page', BaseFieldOverride::load('node.article.promote')->label());
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue