diff --git a/core/includes/common.inc b/core/includes/common.inc index 44fa367..ef92ab5 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2097,9 +2097,9 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) { * Defaults to empty string when clean URLs are in effect, and to * 'index.php/' when they are not. * - 'entity_type': The entity type of the object that called url(). Only - * set if url() is invoked by Drupal\entity\Entity::uri(). + * set if url() is invoked by Drupal\Core\Entity\Entity::uri(). * - 'entity': The entity object (such as a node) for which the URL is being - * generated. Only set if url() is invoked by Drupal\entity\Entity::uri(). + * generated. Only set if url() is invoked by Drupal\Core\Entity\Entity::uri(). * * @return * A string containing a URL to the given path. diff --git a/core/modules/entity/entity.module b/core/includes/entity.inc similarity index 88% rename from core/modules/entity/entity.module rename to core/includes/entity.inc index 74f2fcf..16c1006 100644 --- a/core/modules/entity/entity.module +++ b/core/includes/entity.inc @@ -6,37 +6,10 @@ */ use \InvalidArgumentException; -use Drupal\entity\EntityFieldQuery; -use Drupal\entity\EntityMalformedException; -use Drupal\entity\EntityStorageException; -use Drupal\entity\EntityInterface; - -/** - * Implements hook_help(). - */ -function entity_help($path, $arg) { - switch ($path) { - case 'admin/help#entity': - $output = ''; - $output .= '

' . t('About') . '

'; - $output .= '

' . t('The Entity module provides an API for managing entities like nodes and users, i.e. an API for loading and identifying entities. For more information, see the online handbook entry for Entity module', array('!url' => 'http://drupal.org/documentation/modules/entity')) . '

'; - return $output; - } -} - -/** - * Implements hook_modules_preenable(). - */ -function entity_modules_preenable() { - entity_info_cache_clear(); -} - -/** - * Implements hook_modules_disabled(). - */ -function entity_modules_disabled() { - entity_info_cache_clear(); -} +use Drupal\Core\Entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityMalformedException; +use Drupal\Core\Entity\EntityStorageException; +use Drupal\Core\Entity\EntityInterface; /** * Gets the entity info array of an entity type. @@ -72,10 +45,10 @@ function entity_get_info($entity_type = NULL) { foreach ($entity_info as $name => $data) { $entity_info[$name] += array( 'fieldable' => FALSE, - 'entity class' => 'Drupal\entity\Entity', - 'controller class' => 'Drupal\entity\DatabaseStorageController', + 'entity class' => 'Drupal\Core\Entity\Entity', + 'controller class' => 'Drupal\Core\Entity\DatabaseStorageController', 'form controller class' => array( - 'default' => 'Drupal\entity\EntityFormController', + 'default' => 'Drupal\Core\Entity\EntityFormController', ), 'static cache' => TRUE, 'field cache' => TRUE, @@ -99,7 +72,7 @@ function entity_get_info($entity_type = NULL) { $entity_info[$name]['bundles'] = array($name => array('label' => $entity_info[$name]['label'])); } // Prepare entity schema fields SQL info for - // Drupal\entity\DatabaseStorageControllerInterface::buildQuery(). + // Drupal\Core\Entity\DatabaseStorageControllerInterface::buildQuery(). if (isset($entity_info[$name]['base table'])) { $entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']); if (isset($entity_info[$name]['revision table'])) { @@ -140,14 +113,14 @@ function entity_info_cache_clear() { * @param bool $reset * Whether to reset the internal cache for the requested entity type. * - * @return Drupal\entity\EntityInterface + * @return Drupal\Core\Entity\EntityInterface * The entity object, or FALSE if there is no entity with the given id. * * @see hook_entity_info() * @see entity_load_multiple() - * @see Drupal\entity\StorageControllerInterface - * @see Drupal\entity\DatabaseStorageController - * @see Drupal\entity\EntityFieldQuery + * @see Drupal\Core\Entity\StorageControllerInterface + * @see Drupal\Core\Entity\DatabaseStorageController + * @see Drupal\Core\Entity\EntityFieldQuery */ function entity_load($entity_type, $id, $reset = FALSE) { $entities = entity_load_multiple($entity_type, array($id), $reset); @@ -162,13 +135,13 @@ function entity_load($entity_type, $id, $reset = FALSE) { * @param int $revision_id * The id of the entity to load. * - * @return Drupal\entity\EntityInterface + * @return Drupal\Core\Entity\EntityInterface * The entity object, or FALSE if there is no entity with the given revision * id. * * @see hook_entity_info() - * @see Drupal\entity\EntityStorageControllerInterface - * @see Drupal\entity\DatabaseStorageController + * @see Drupal\Core\Entity\EntityStorageControllerInterface + * @see Drupal\Core\Entity\DatabaseStorageController */ function entity_revision_load($entity_type, $revision_id) { return entity_get_controller($entity_type)->loadRevision($revision_id); @@ -189,7 +162,7 @@ function entity_revision_load($entity_type, $revision_id) { * @return EntityInterface|FALSE * The entity object, or FALSE if there is no entity with the given UUID. * - * @throws Drupal\entity\EntityStorageException + * @throws Drupal\Core\Entity\EntityStorageException * Thrown in case the requested entity type does not support UUIDs. * * @see hook_entity_info() @@ -217,12 +190,12 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { * database access if loaded again during the same page request. * * The actual loading is done through a class that has to implement the - * Drupal\entity\StorageControllerInterface interface. By default, - * Drupal\entity\DatabaseStorageController is used. Entity types can + * Drupal\Core\Entity\StorageControllerInterface interface. By default, + * Drupal\Core\Entity\DatabaseStorageController is used. Entity types can * specify that a different class should be used by setting the * 'controller class' key in hook_entity_info(). These classes can either - * implement the Drupal\entity\StorageControllerInterface interface, or, - * most commonly, extend the Drupal\entity\DatabaseStorageController + * implement the Drupal\Core\Entity\StorageControllerInterface interface, or, + * most commonly, extend the Drupal\Core\Entity\DatabaseStorageController * class. See node_entity_info() and the NodeStorageController in node.module as * an example. * @@ -237,9 +210,9 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { * An array of entity objects indexed by their ids. * * @see hook_entity_info() - * @see Drupal\entity\StorageControllerInterface - * @see Drupal\entity\DatabaseStorageController - * @see Drupal\entity\EntityFieldQuery + * @see Drupal\Core\Entity\StorageControllerInterface + * @see Drupal\Core\Entity\DatabaseStorageController + * @see Drupal\Core\Entity\EntityFieldQuery */ function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { if ($reset) { @@ -307,7 +280,7 @@ function entity_delete_multiple($entity_type, $ids) { * An array of values to set, keyed by property name. If the entity type has * bundles the bundle key has to be specified. * - * @return Drupal\entity\EntityInterface + * @return Drupal\Core\Entity\EntityInterface * A new entity object. */ function entity_create($entity_type, array $values) { @@ -317,7 +290,7 @@ function entity_create($entity_type, array $values) { /** * Gets the entity controller class for an entity type. * - * @return Drupal\entity\StorageControllerInterface + * @return Drupal\Core\Entity\StorageControllerInterface */ function entity_get_controller($entity_type) { $controllers = &drupal_static(__FUNCTION__, array()); @@ -373,10 +346,10 @@ function entity_prepare_view($entity_type, $entities) { /** * Returns the label of an entity. * - * This is a wrapper for Drupal\entity\EntityInterface::label(). This function + * This is a wrapper for Drupal\Core\Entity\EntityInterface::label(). This function * should only be used as a callback, e.g. for menu title callbacks. * - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity for which to generate the label. * @param $langcode * (optional) The language code of the language that should be used for @@ -386,7 +359,7 @@ function entity_prepare_view($entity_type, $entities) { * @return * The label of the entity, or NULL if there is no label defined. * - * @see Drupal\entity\EntityInterface::label() + * @see Drupal\Core\Entity\EntityInterface::label() */ function entity_page_label(EntityInterface $entity, $langcode = NULL) { return $entity->label($langcode); @@ -410,7 +383,7 @@ function entity_page_label(EntityInterface $entity, $langcode = NULL) { * identifying the controlled form. Defaults to 'default' which is the usual * create/edit form. * - * @return Drupal\entity\EntityFormControllerInterface + * @return Drupal\Core\Entity\EntityFormControllerInterface * An entity form controller instance. */ function entity_form_controller($entity_type, $operation = 'default') { @@ -422,7 +395,7 @@ function entity_form_controller($entity_type, $operation = 'default') { } // If no controller is specified default to the base implementation. elseif (empty($info['form controller class']) && $operation == 'default') { - $class = 'Drupal\entity\EntityFormController'; + $class = 'Drupal\Core\Entity\EntityFormController'; } // If a non-existing operation has been specified stop. else { diff --git a/core/includes/file.inc b/core/includes/file.inc index ed4bdce..caebca1 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -589,7 +589,7 @@ function file_save_htaccess($directory, $private = TRUE) { * @see hook_file_load() * @see file_load() * @see entity_load() - * @see Drupal\entity\EntityFieldQuery + * @see Drupal\Core\Entity\EntityFieldQuery */ function file_load_multiple(array $fids = NULL) { return entity_load_multiple('file', $fids); diff --git a/core/includes/module.inc b/core/includes/module.inc index ab45576..023cc7b 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -479,6 +479,7 @@ function module_enable($module_list, $enable_dependencies = TRUE) { } // Allow modules to react prior to the enabling of a module. + entity_info_cache_clear(); module_invoke_all('modules_preenable', array($module)); // Enable the module. @@ -563,6 +564,7 @@ function module_disable($module_list, $disable_dependents = TRUE) { // Refresh the module list to exclude the disabled modules. system_list_reset(); module_implements_reset(); + entity_info_cache_clear(); // Invoke hook_modules_disabled before disabling modules, // so we can still call module hooks to get information. module_invoke_all('modules_disabled', $invoke_modules); diff --git a/core/modules/entity/lib/Drupal/entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php similarity index 93% rename from core/modules/entity/lib/Drupal/entity/DatabaseStorageController.php rename to core/lib/Drupal/Core/Entity/DatabaseStorageController.php index 2634041..5858025 100644 --- a/core/modules/entity/lib/Drupal/entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\DatabaseStorageController. + * Definition of Drupal\Core\Entity\DatabaseStorageController. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; use PDO; use Drupal\Component\Uuid\Uuid; @@ -14,7 +14,7 @@ /** * Defines a base entity controller class. * - * Default implementation of Drupal\entity\DatabaseStorageControllerInterface. + * Default implementation of Drupal\Core\Entity\DatabaseStorageControllerInterface. * * This class can be used as-is by most simple entity types. Entity types * requiring special handling can extend the class. @@ -47,7 +47,7 @@ class DatabaseStorageController implements EntityStorageControllerInterface { /** * Additional arguments to pass to hook_TYPE_load(). * - * Set before calling Drupal\entity\DatabaseStorageController::attachLoad(). + * Set before calling Drupal\Core\Entity\DatabaseStorageController::attachLoad(). * * @var array */ @@ -95,7 +95,7 @@ class DatabaseStorageController implements EntityStorageControllerInterface { protected $cache; /** - * Implements Drupal\entity\EntityStorageControllerInterface::__construct(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::__construct(). * * Sets basic variables. */ @@ -128,7 +128,7 @@ public function __construct($entityType) { } /** - * Implements Drupal\entity\EntityStorageControllerInterface::resetCache(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::resetCache(). */ public function resetCache(array $ids = NULL) { if (isset($ids)) { @@ -142,7 +142,7 @@ public function resetCache(array $ids = NULL) { } /** - * Implements Drupal\entity\EntityStorageControllerInterface::load(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::load(). */ public function load(array $ids = NULL) { $entities = array(); @@ -173,7 +173,7 @@ public function load(array $ids = NULL) { if (!empty($this->entityInfo['entity class'])) { // We provide the necessary arguments for PDO to create objects of the // specified entity class. - // @see Drupal\entity\StorableInterface::__construct() + // @see Drupal\Core\Entity\StorableInterface::__construct() $query_result->setFetchMode(PDO::FETCH_CLASS, $this->entityInfo['entity class'], array(array(), $this->entityType)); } $queried_entities = $query_result->fetchAllAssoc($this->idKey); @@ -209,7 +209,7 @@ public function load(array $ids = NULL) { } /** - * Implements Drupal\entity\EntityStorageControllerInterface::loadRevision(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadRevision(). */ public function loadRevision($revision_id) { // Build and execute the query. @@ -218,7 +218,7 @@ public function loadRevision($revision_id) { if (!empty($this->entityInfo['entity class'])) { // We provide the necessary arguments for PDO to create objects of the // specified entity class. - // @see Drupal\entity\EntityInterface::__construct() + // @see Drupal\Core\Entity\EntityInterface::__construct() $query_result->setFetchMode(PDO::FETCH_CLASS, $this->entityInfo['entity class'], array(array(), $this->entityType)); } $queried_entities = $query_result->fetchAllAssoc($this->idKey); @@ -233,7 +233,7 @@ public function loadRevision($revision_id) { } /** - * Implements Drupal\entity\EntityStorageControllerInterface::loadByProperties(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::loadByProperties(). */ public function loadByProperties(array $values = array()) { // Build a query to fetch the entity IDs. @@ -252,7 +252,7 @@ public function loadByProperties(array $values = array()) { /** * Builds an entity query. * - * @param Drupal\entity\EntityFieldQuery $entity_query + * @param Drupal\Core\Entity\EntityFieldQuery $entity_query * EntityFieldQuery instance. * @param array $values * An associative array of properties of the entity, where the keys are the @@ -399,10 +399,10 @@ protected function cacheSet($entities) { } /** - * Implements Drupal\entity\EntityStorageControllerInterface::create(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::create(). */ public function create(array $values) { - $class = isset($this->entityInfo['entity class']) ? $this->entityInfo['entity class'] : 'Drupal\entity\Entity'; + $class = isset($this->entityInfo['entity class']) ? $this->entityInfo['entity class'] : 'Drupal\Core\Entity\Entity'; $entity = new $class($values, $this->entityType); @@ -416,7 +416,7 @@ public function create(array $values) { } /** - * Implements Drupal\entity\EntityStorageControllerInterface::delete(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::delete(). */ public function delete($ids) { $entities = $ids ? $this->load($ids) : FALSE; @@ -454,7 +454,7 @@ public function delete($ids) { } /** - * Implements Drupal\entity\EntityStorageControllerInterface::save(). + * Implements Drupal\Core\Entity\EntityStorageControllerInterface::save(). */ public function save(StorableInterface $entity) { $transaction = db_transaction(); diff --git a/core/modules/entity/lib/Drupal/entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php similarity index 82% rename from core/modules/entity/lib/Drupal/entity/Entity.php rename to core/lib/Drupal/Core/Entity/Entity.php index 6660fc7..8be7c0d 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\Entity. + * Definition of Drupal\Core\Entity\Entity. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; use Drupal\Component\Uuid\Uuid; diff --git a/core/modules/entity/lib/Drupal/entity/EntityFieldQuery.php b/core/lib/Drupal/Core/Entity/EntityFieldQuery.php similarity index 93% rename from core/modules/entity/lib/Drupal/entity/EntityFieldQuery.php rename to core/lib/Drupal/Core/Entity/EntityFieldQuery.php index fc283fc..979cb2f 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityFieldQuery.php +++ b/core/lib/Drupal/Core/Entity/EntityFieldQuery.php @@ -2,12 +2,12 @@ /** * @file - * Definition of Drupal\entity\EntityFieldQuery. + * Definition of Drupal\Core\Entity\EntityFieldQuery. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; -use Drupal\entity\EntityFieldQueryException; +use Drupal\Core\Entity\EntityFieldQueryException; use Drupal\Core\Database\Query\Select; use Drupal\Core\Database\Query\PagerSelectExtender; @@ -44,7 +44,7 @@ class EntityFieldQuery { /** * Indicates that both deleted and non-deleted fields should be returned. * - * @see Drupal\entity\EntityFieldQuery::deleted() + * @see Drupal\Core\Entity\EntityFieldQuery::deleted() */ const RETURN_ALL = NULL; @@ -63,7 +63,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::entityCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::entityCondition() */ public $entityConditions = array(); @@ -72,7 +72,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::fieldCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::fieldCondition() */ public $fieldConditions = array(); @@ -86,8 +86,8 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::fieldLanguageCondition() - * @see Drupal\entity\EntityFieldQuery::fieldDeltaCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::fieldLanguageCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::fieldDeltaCondition() */ public $fieldMetaConditions = array(); @@ -96,7 +96,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::propertyCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::propertyCondition() */ public $propertyConditions = array(); @@ -112,7 +112,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::range() + * @see Drupal\Core\Entity\EntityFieldQuery::range() */ public $range = array(); @@ -121,7 +121,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::pager() + * @see Drupal\Core\Entity\EntityFieldQuery::pager() */ public $pager = array(); @@ -131,7 +131,7 @@ class EntityFieldQuery { * TRUE to return only deleted data, FALSE to return only non-deleted data, * EntityFieldQuery::RETURN_ALL to return everything. * - * @see Drupal\entity\EntityFieldQuery::deleted() + * @see Drupal\Core\Entity\EntityFieldQuery::deleted() */ public $deleted = FALSE; @@ -159,7 +159,7 @@ class EntityFieldQuery { * * @var int * - * @see Drupal\entity\EntityFieldQuery::age() + * @see Drupal\Core\Entity\EntityFieldQuery::age() */ public $age = FIELD_LOAD_CURRENT; @@ -168,7 +168,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::addTag() + * @see Drupal\Core\Entity\EntityFieldQuery::addTag() */ public $tags = array(); @@ -177,7 +177,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::addMetaData() + * @see Drupal\Core\Entity\EntityFieldQuery::addMetaData() */ public $metaData = array(); @@ -186,7 +186,7 @@ class EntityFieldQuery { * * @var array * - * @see Drupal\entity\EntityFieldQuery::execute(). + * @see Drupal\Core\Entity\EntityFieldQuery::execute(). */ public $orderedResults = array(); @@ -195,7 +195,7 @@ class EntityFieldQuery { * * @var string * - * @see Drupal\entity\EntityFieldQuery::execute() + * @see Drupal\Core\Entity\EntityFieldQuery::execute() */ public $executeCallback = ''; @@ -233,7 +233,7 @@ class EntityFieldQuery { * The operator can be omitted, and will default to 'IN' if the value is an * array, or to '=' otherwise. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function entityCondition($name, $value, $operator = NULL) { @@ -265,11 +265,11 @@ public function entityCondition($name, $value, $operator = NULL) { * An arbitrary identifier: conditions in the same group must have the same * $langcode_group. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. * - * @see Drupal\entity\EntityFieldQuery::addFieldCondition() - * @see Drupal\entity\EntityFieldQuery::deleted() + * @see Drupal\Core\Entity\EntityFieldQuery::addFieldCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::deleted() */ public function fieldCondition($field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) { return $this->addFieldCondition($this->fieldConditions, $field, $column, $value, $operator, $delta_group, $langcode_group); @@ -291,11 +291,11 @@ public function fieldCondition($field, $column = NULL, $value = NULL, $operator * An arbitrary identifier: conditions in the same group must have the same * $langcode_group. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. * - * @see Drupal\entity\EntityFieldQuery::addFieldCondition() - * @see Drupal\entity\EntityFieldQuery::deleted() + * @see Drupal\Core\Entity\EntityFieldQuery::addFieldCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::deleted() */ public function fieldLanguageCondition($field, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) { return $this->addFieldCondition($this->fieldMetaConditions, $field, 'langcode', $value, $operator, $delta_group, $langcode_group); @@ -317,11 +317,11 @@ public function fieldLanguageCondition($field, $value = NULL, $operator = NULL, * An arbitrary identifier: conditions in the same group must have the same * $langcode_group. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. * - * @see Drupal\entity\EntityFieldQuery::addFieldCondition() - * @see Drupal\entity\EntityFieldQuery::deleted() + * @see Drupal\Core\Entity\EntityFieldQuery::addFieldCondition() + * @see Drupal\Core\Entity\EntityFieldQuery::deleted() */ public function fieldDeltaCondition($field, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) { return $this->addFieldCondition($this->fieldMetaConditions, $field, 'delta', $value, $operator, $delta_group, $langcode_group); @@ -367,7 +367,7 @@ public function fieldDeltaCondition($field, $value = NULL, $operator = NULL, $de * An arbitrary identifier: conditions in the same group must have the same * $langcode_group. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ protected function addFieldCondition(&$conditions, $field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $langcode_group = NULL) { @@ -421,7 +421,7 @@ protected function addFieldCondition(&$conditions, $field, $column = NULL, $valu * The operator can be omitted, and will default to 'IN' if the value is an * array, or to '=' otherwise. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function propertyCondition($column, $value, $operator = NULL) { @@ -447,7 +447,7 @@ public function propertyCondition($column, $value, $operator = NULL) { * @param $direction * The direction to sort. Legal values are "ASC" and "DESC". * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function entityOrderBy($name, $direction = 'ASC') { @@ -475,7 +475,7 @@ public function entityOrderBy($name, $direction = 'ASC') { * @param $direction * The direction to sort. Legal values are "ASC" and "DESC". * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function fieldOrderBy($field, $column, $direction = 'ASC') { @@ -516,7 +516,7 @@ public function fieldOrderBy($field, $column, $direction = 'ASC') { * @param $direction * The direction to sort. Legal values are "ASC" and "DESC". * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function propertyOrderBy($column, $direction = 'ASC') { @@ -531,7 +531,7 @@ public function propertyOrderBy($column, $direction = 'ASC') { /** * Sets the query to be a count query only. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function count() { @@ -548,7 +548,7 @@ public function count() { * @param $length * The number of entities to return from the result set. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function range($start = NULL, $length = NULL) { @@ -569,7 +569,7 @@ public function range($start = NULL, $length = NULL) { * An optional integer to distinguish between multiple pagers on one page. * If not provided, one is automatically calculated. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function pager($limit = 10, $element = NULL) { @@ -594,7 +594,7 @@ public function pager($limit = 10, $element = NULL) { * An EFQ Header array based on which the order clause is added to the * query. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function tableSort(&$headers) { @@ -629,7 +629,7 @@ public function tableSort(&$headers) { * TRUE to only return deleted data, FALSE to return non-deleted data, * EntityFieldQuery::RETURN_ALL to return everything. Defaults to FALSE. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function deleted($deleted = TRUE) { @@ -650,7 +650,7 @@ public function deleted($deleted = TRUE) { * - FIELD_LOAD_REVISION: Query all revisions. The results will be keyed by * entity type and entity revision ID. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function age($age) { @@ -675,7 +675,7 @@ public function age($age) { * @param string $tag * The tag to add. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function addTag($tag) { @@ -696,7 +696,7 @@ public function addTag($tag) { * @param $object * The additional data to add to the query. May be any valid PHP variable. * - * @return Drupal\entity\EntityFieldQuery + * @return Drupal\Core\Entity\EntityFieldQuery * The called object. */ public function addMetaData($key, $object) { diff --git a/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php b/core/lib/Drupal/Core/Entity/EntityFieldQueryException.php similarity index 79% rename from core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php rename to core/lib/Drupal/Core/Entity/EntityFieldQueryException.php index 12f2a1c..bf792a5 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityFieldQueryException.php +++ b/core/lib/Drupal/Core/Entity/EntityFieldQueryException.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\EntityFieldQueryException. + * Definition of Drupal\Core\Entity\EntityFieldQueryException. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; use Exception; diff --git a/core/modules/entity/lib/Drupal/entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php similarity index 89% rename from core/modules/entity/lib/Drupal/entity/EntityFormController.php rename to core/lib/Drupal/Core/Entity/EntityFormController.php index 4f1263c..5b83743 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\EntityFormController. + * Definition of Drupal\Core\Entity\EntityFormController. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; /** * Base class for entity form controllers. @@ -23,14 +23,14 @@ class EntityFormController implements EntityFormControllerInterface { protected $operation; /** - * Implements Drupal\entity\EntityFormControllerInterface::__construct(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::__construct(). */ public function __construct($operation) { $this->operation = $operation; } /** - * Implements Drupal\entity\EntityFormControllerInterface::build(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::build(). */ public function build(array $form, array &$form_state, EntityInterface $entity) { @@ -68,7 +68,7 @@ protected function init(array &$form_state, EntityInterface $entity) { /** * Returns the actual form array to be built. * - * @see Drupal\entity\EntityFormController::build() + * @see Drupal\Core\Entity\EntityFormController::build() */ public function form(array $form, array &$form_state, EntityInterface $entity) { // @todo Exploit the Property API to generate the default widgets for the @@ -142,7 +142,7 @@ protected function actions(array $form, array &$form_state) { } /** - * Implements Drupal\entity\EntityFormControllerInterface::validate(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::validate(). */ public function validate(array $form, array &$form_state) { // @todo Exploit the Property API to validate the values submitted for the @@ -161,7 +161,7 @@ public function validate(array $form, array &$form_state) { } /** - * Implements Drupal\entity\EntityFormControllerInterface::submit(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::submit(). * * This is the default entity object builder function. It is called before any * other submit handler to build the new entity object to be passed to the @@ -205,7 +205,7 @@ public function delete(array $form, array &$form_state) { } /** - * Implements Drupal\entity\EntityFormControllerInterface::getFormLangcode(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::getFormLangcode(). */ public function getFormLangcode($form_state) { // @todo Introduce a new form language type (see hook_language_types_info()) @@ -216,7 +216,7 @@ public function getFormLangcode($form_state) { } /** - * Implements Drupal\entity\EntityFormControllerInterface::buildEntity(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::buildEntity(). */ public function buildEntity(array $form, array &$form_state) { $entity = clone $this->getEntity($form_state); @@ -227,14 +227,14 @@ public function buildEntity(array $form, array &$form_state) { } /** - * Implements Drupal\entity\EntityFormControllerInterface::getEntity(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::getEntity(). */ public function getEntity(array $form_state) { return isset($form_state['entity']) ? $form_state['entity'] : NULL; } /** - * Implements Drupal\entity\EntityFormControllerInterface::setEntity(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::setEntity(). */ public function setEntity(EntityInterface $entity, array &$form_state) { $form_state['entity'] = $entity; @@ -248,7 +248,7 @@ protected function prepareEntity(EntityInterface $entity) { } /** - * Implements Drupal\entity\EntityFormControllerInterface::getOperation(). + * Implements Drupal\Core\Entity\EntityFormControllerInterface::getOperation(). */ public function getOperation() { return $this->operation; diff --git a/core/modules/entity/lib/Drupal/entity/EntityFormControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php similarity index 88% rename from core/modules/entity/lib/Drupal/entity/EntityFormControllerInterface.php rename to core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php index 6765d85..7a615f6 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityFormControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\EntityFormControllerInterface. + * Definition of Drupal\Core\Entity\EntityFormControllerInterface. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; /** * Defines a common interface for entity form controller classes. @@ -32,7 +32,7 @@ public function __construct($operation); * An associative array containing the current state of the form. * @param string $entity_type * The type of the entity being edited. - * @param \Drupal\entity\EntityInterface $entity + * @param \Drupal\Core\Entity\EntityInterface $entity * The entity being edited. * * @return array @@ -67,7 +67,7 @@ public function getOperation(); * @param array $form_state * An associative array containing the current state of the form. * - * @return \Drupal\entity\EntityInterface + * @return \Drupal\Core\Entity\EntityInterface * The current form entity. */ public function getEntity(array $form_state); @@ -77,11 +77,11 @@ public function getEntity(array $form_state); * * Sets the form entity which will be used for populating form element * defaults. Usually, the form entity gets updated by - * \Drupal\entity\EntityFormControllerInterface::submit(), however this may + * \Drupal\Core\Entity\EntityFormControllerInterface::submit(), however this may * be used to completely exchange the form entity, e.g. when preparing the * rebuild of a multi-step form. * - * @param \Drupal\entity\EntityInterface $entity + * @param \Drupal\Core\Entity\EntityInterface $entity * The entity the current form should operate upon. * @param array $form_state * An associative array containing the current state of the form. @@ -95,14 +95,14 @@ public function setEntity(EntityInterface $entity, array &$form_state); * the submitted form values are copied to entity properties. The form's * entity remains unchanged. * - * @see \Drupal\entity\EntityFormControllerInterface::getEntity() + * @see \Drupal\Core\Entity\EntityFormControllerInterface::getEntity() * * @param array $form * A nested array form elements comprising the form. * @param array $form_state * An associative array containing the current state of the form. * - * @return \Drupal\entity\EntityInterface + * @return \Drupal\Core\Entity\EntityInterface * An updated copy of the form's entity object. */ public function buildEntity(array $form, array &$form_state); diff --git a/core/modules/entity/lib/Drupal/entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php similarity index 63% rename from core/modules/entity/lib/Drupal/entity/EntityInterface.php rename to core/lib/Drupal/Core/Entity/EntityInterface.php index 1fc1d0a..87a1421 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\EntityInterface. + * Definition of Drupal\Core\Entity\EntityInterface. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; /** * Defines a common interface for all entity objects. diff --git a/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php b/core/lib/Drupal/Core/Entity/EntityMalformedException.php similarity index 64% rename from core/modules/entity/lib/Drupal/entity/EntityMalformedException.php rename to core/lib/Drupal/Core/Entity/EntityMalformedException.php index bd9b500..ae60cba 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityMalformedException.php +++ b/core/lib/Drupal/Core/Entity/EntityMalformedException.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\EntityMalformedException. + * Definition of Drupal\Core\Entity\EntityMalformedException. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; use Exception; diff --git a/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php similarity index 71% rename from core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php rename to core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php index a215184..a1fdeac 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityStorageControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerInterface.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\EntityStorageControllerInterface. + * Definition of Drupal\Core\Entity\EntityStorageControllerInterface. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; /** * Defines a common interface for entity controller classes. @@ -15,7 +15,7 @@ * this interface. * * Most simple, SQL-based entity controllers will do better by extending - * Drupal\entity\DatabaseStorageController instead of implementing this + * Drupal\Core\Entity\DatabaseStorageController instead of implementing this * interface directly. */ interface EntityStorageControllerInterface extends StorageControllerInterface { diff --git a/core/modules/entity/lib/Drupal/entity/EntityStorageException.php b/core/lib/Drupal/Core/Entity/EntityStorageException.php similarity index 64% rename from core/modules/entity/lib/Drupal/entity/EntityStorageException.php rename to core/lib/Drupal/Core/Entity/EntityStorageException.php index dff3e93..53ff738 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityStorageException.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageException.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\EntityStorageException. + * Definition of Drupal\Core\Entity\EntityStorageException. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; use Exception; diff --git a/core/modules/entity/lib/Drupal/entity/StorableBase.php b/core/lib/Drupal/Core/Entity/StorableBase.php similarity index 97% rename from core/modules/entity/lib/Drupal/entity/StorableBase.php rename to core/lib/Drupal/Core/Entity/StorableBase.php index 57bf352..8c8a143 100644 --- a/core/modules/entity/lib/Drupal/entity/StorableBase.php +++ b/core/lib/Drupal/Core/Entity/StorableBase.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\StorableBase. + * Definition of Drupal\Core\Entity\StorableBase. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; use Drupal\Component\Uuid\Uuid; @@ -271,14 +271,14 @@ public function entityInfo() { } /** - * Implements Drupal\entity\StorableInterface::getRevisionId(). + * Implements Drupal\Core\Entity\StorableInterface::getRevisionId(). */ public function getRevisionId() { return NULL; } /** - * Implements Drupal\entity\StorableInterface::isCurrentRevision(). + * Implements Drupal\Core\Entity\StorableInterface::isCurrentRevision(). */ public function isCurrentRevision() { return $this->isCurrentRevision; diff --git a/core/modules/entity/lib/Drupal/entity/StorableInterface.php b/core/lib/Drupal/Core/Entity/StorableInterface.php similarity index 89% rename from core/modules/entity/lib/Drupal/entity/StorableInterface.php rename to core/lib/Drupal/Core/Entity/StorableInterface.php index 820fdc7..c7ca075 100644 --- a/core/modules/entity/lib/Drupal/entity/StorableInterface.php +++ b/core/lib/Drupal/Core/Entity/StorableInterface.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\StorableInterface. + * Definition of Drupal\Core\Entity\StorableInterface. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; /** * Defines a common interface for all entity objects. @@ -52,7 +52,7 @@ public function uuid(); * @return * TRUE if the entity is new, or FALSE if the entity has already been saved. * - * @see Drupal\entity\StorableInterface::enforceIsNew() + * @see Drupal\Core\Entity\StorableInterface::enforceIsNew() */ public function isNew(); @@ -66,7 +66,7 @@ public function isNew(); * (optional) Whether the entity should be forced to be new. Defaults to * TRUE. * - * @see Drupal\entity\StorableInterface::isNew() + * @see Drupal\Core\Entity\StorableInterface::isNew() */ public function enforceIsNew($value = TRUE); @@ -117,7 +117,7 @@ public function uri(); * The language object of the entity's default language, or FALSE if the * entity is not language-specific. * - * @see Drupal\entity\StorableInterface::translations() + * @see Drupal\Core\Entity\StorableInterface::translations() */ public function language(); @@ -127,7 +127,7 @@ public function language(); * @return * An array of language objects, keyed by language codes. * - * @see Drupal\entity\StorableInterface::language() + * @see Drupal\Core\Entity\StorableInterface::language() */ public function translations(); @@ -144,7 +144,7 @@ public function translations(); * @return * The property value, or NULL if it is not defined. * - * @see Drupal\entity\StorableInterface::language() + * @see Drupal\Core\Entity\StorableInterface::language() */ public function get($property_name, $langcode = NULL); @@ -160,7 +160,7 @@ public function get($property_name, $langcode = NULL); * language that should be used for getting the property. If set to * NULL, the entity's default language is being used. * - * @see Drupal\entity\StorableInterface::language() + * @see Drupal\Core\Entity\StorableInterface::language() */ public function set($property_name, $value, $langcode = NULL); @@ -170,7 +170,7 @@ public function set($property_name, $value, $langcode = NULL); * @return * Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed. * - * @throws Drupal\entity\EntityStorageException + * @throws Drupal\Core\Entity\EntityStorageException * In case of failures an exception is thrown. */ public function save(); @@ -178,7 +178,7 @@ public function save(); /** * Deletes an entity permanently. * - * @throws Drupal\entity\EntityStorageException + * @throws Drupal\Core\Entity\EntityStorageException * In case of failures an exception is thrown. */ public function delete(); @@ -186,7 +186,7 @@ public function delete(); /** * Creates a duplicate of the entity. * - * @return Drupal\entity\StorableInterface + * @return Drupal\Core\Entity\StorableInterface * A clone of the current entity with all identifiers unset, so saving * it inserts a new entity into the storage system. */ diff --git a/core/modules/entity/lib/Drupal/entity/StorageControllerInterface.php b/core/lib/Drupal/Core/Entity/StorageControllerInterface.php similarity index 82% rename from core/modules/entity/lib/Drupal/entity/StorageControllerInterface.php rename to core/lib/Drupal/Core/Entity/StorageControllerInterface.php index 8b5c4fd..c4c7f4d 100644 --- a/core/modules/entity/lib/Drupal/entity/StorageControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/StorageControllerInterface.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\StorageControllerInterface. + * Definition of Drupal\Core\Entity\StorageControllerInterface. */ -namespace Drupal\entity; +namespace Drupal\Core\Entity; /** * Defines a common interface for entity controller classes. @@ -15,13 +15,13 @@ * this interface. * * Most simple, SQL-based entity controllers will do better by extending - * Drupal\entity\DatabaseStorageController instead of implementing this + * Drupal\Core\Entity\DatabaseStorageController instead of implementing this * interface directly. */ interface StorageControllerInterface { /** - * Constructs a new Drupal\entity\StorageControllerInterface object. + * Constructs a new Drupal\Core\Entity\StorageControllerInterface object. * * @param $entityType * The entity type for which the instance is created. @@ -54,7 +54,7 @@ public function load(array $ids = NULL); * @param int $revision_id * The revision id. * - * @return Drupal\entity\StorableInterface|false + * @return Drupal\Core\Entity\StorableInterface|false * The specified entity revision or FALSE if not found. */ public function loadRevision($revision_id); @@ -78,7 +78,7 @@ public function loadByProperties(array $values); * An array of values to set, keyed by property name. If the entity type has * bundles the bundle key has to be specified. * - * @return Drupal\entity\StorableInterface + * @return Drupal\Core\Entity\StorableInterface * A new entity object. */ public function create(array $values); @@ -89,7 +89,7 @@ public function create(array $values); * @param $ids * An array of entity IDs. * - * @throws Drupal\entity\EntityStorageException + * @throws Drupal\Core\Entity\EntityStorageException * In case of failures, an exception is thrown. */ public function delete($ids); @@ -97,14 +97,14 @@ public function delete($ids); /** * Saves the entity permanently. * - * @param Drupal\entity\StorableInterface $entity + * @param Drupal\Core\Entity\StorableInterface $entity * The entity to save. * * @return * SAVED_NEW or SAVED_UPDATED is returned depending on the operation * performed. * - * @throws Drupal\entity\EntityStorageException + * @throws Drupal\Core\Entity\EntityStorageException * In case of failures, an exception is thrown. */ public function save(StorableInterface $entity); diff --git a/core/lib/Drupal/Core/File/File.php b/core/lib/Drupal/Core/File/File.php index 2e5e67d..8c986e2 100644 --- a/core/lib/Drupal/Core/File/File.php +++ b/core/lib/Drupal/Core/File/File.php @@ -7,7 +7,7 @@ namespace Drupal\Core\File; -use Drupal\entity\Entity; +use Drupal\Core\Entity\Entity; /** * Defines the file entity class. @@ -92,7 +92,7 @@ class File extends Entity { public $timestamp; /** - * Overrides Drupal\entity\Entity::id(). + * Overrides Drupal\Core\Entity\Entity::id(). */ public function id() { return $this->fid; diff --git a/core/lib/Drupal/Core/File/FileStorageController.php b/core/lib/Drupal/Core/File/FileStorageController.php index dd8ee7a..de46c1e 100644 --- a/core/lib/Drupal/Core/File/FileStorageController.php +++ b/core/lib/Drupal/Core/File/FileStorageController.php @@ -7,8 +7,8 @@ namespace Drupal\Core\File; -use Drupal\entity\DatabaseStorageController; -use Drupal\entity\StorableInterface; +use Drupal\Core\Entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; /** * File storage controller for files. @@ -16,7 +16,7 @@ class FileStorageController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::create(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::create(). */ public function create(array $values) { // Automatically detect filename if not set. @@ -32,7 +32,7 @@ public function create(array $values) { } /** - * Overrides Drupal\entity\DatabaseStorageController::presave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::presave(). */ protected function preSave(StorableInterface $entity) { $entity->timestamp = REQUEST_TIME; @@ -47,7 +47,7 @@ protected function preSave(StorableInterface $entity) { } /** - * Overrides Drupal\entity\DatabaseStorageController::preDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::preDelete(). */ public function preDelete($entities) { foreach ($entities as $entity) { diff --git a/core/modules/comment/comment.api.php b/core/modules/comment/comment.api.php index fded934..96307ec 100644 --- a/core/modules/comment/comment.api.php +++ b/core/modules/comment/comment.api.php @@ -1,7 +1,5 @@ cid; } /** - * Implements Drupal\entity\EntityInterface::bundle(). + * Implements Drupal\Core\Entity\EntityInterface::bundle(). */ public function bundle() { return $this->node_type; diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index f0f16c2..7dae92d 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -7,8 +7,8 @@ namespace Drupal\comment; -use Drupal\entity\EntityInterface; -use Drupal\entity\EntityFormController; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityFormController; /** * Base for controller for comment forms. @@ -16,7 +16,7 @@ class CommentFormController extends EntityFormController { /** - * Overrides Drupal\entity\EntityFormController::form(). + * Overrides Drupal\Core\Entity\EntityFormController::form(). */ public function form(array $form, array &$form_state, EntityInterface $comment) { global $user; @@ -193,7 +193,7 @@ public function form(array $form, array &$form_state, EntityInterface $comment) } /** - * Overrides Drupal\entity\EntityFormController::actions(). + * Overrides Drupal\Core\Entity\EntityFormController::actions(). */ protected function actions(array $form, array &$form_state) { $element = parent::actions($form, $form_state); @@ -227,7 +227,7 @@ protected function actions(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::validate(). + * Overrides Drupal\Core\Entity\EntityFormController::validate(). */ public function validate(array $form, array &$form_state) { parent::validate($form, $form_state); @@ -264,7 +264,7 @@ public function validate(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::submit(). + * Overrides Drupal\Core\Entity\EntityFormController::submit(). */ public function submit(array $form, array &$form_state) { $comment = parent::submit($form, $form_state); @@ -328,7 +328,7 @@ public function preview(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::save(). + * Overrides Drupal\Core\Entity\EntityFormController::save(). */ public function save(array $form, array &$form_state) { $node = node_load($form_state['values']['nid']); diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index 50669a8..7f1d83b 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -7,14 +7,14 @@ namespace Drupal\comment; -use Drupal\entity\StorableInterface; -use Drupal\entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; +use Drupal\Core\Entity\DatabaseStorageController; use LogicException; /** * Defines the controller class for comments. * - * This extends the Drupal\entity\DatabaseStorageController class, adding + * This extends the Drupal\Core\Entity\DatabaseStorageController class, adding * required special handling for comment entities. */ class CommentStorageController extends DatabaseStorageController { @@ -25,7 +25,7 @@ class CommentStorageController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::buildQuery(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::buildQuery(). */ protected function buildQuery($ids, $revision_id = FALSE) { $query = parent::buildQuery($ids, $revision_id); @@ -39,7 +39,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::attachLoad(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::attachLoad(). */ protected function attachLoad(&$comments, $load_revision = FALSE) { // Set up standard comment properties. @@ -53,7 +53,7 @@ protected function attachLoad(&$comments, $load_revision = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::preSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::preSave(). * * @see comment_int_to_alphadecimal() * @see comment_alphadecimal_to_int() @@ -149,7 +149,7 @@ protected function preSave(StorableInterface $comment) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postSave(). */ protected function postSave(StorableInterface $comment, $update) { $this->releaseThreadLock(); @@ -161,7 +161,7 @@ protected function postSave(StorableInterface $comment, $update) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postDelete(). */ protected function postDelete($comments) { // Delete the comments' replies. diff --git a/core/modules/config/lib/Drupal/config/ConfigStorageController.php b/core/modules/config/lib/Drupal/config/ConfigStorageController.php index 57c2583..ee8f17f 100644 --- a/core/modules/config/lib/Drupal/config/ConfigStorageController.php +++ b/core/modules/config/lib/Drupal/config/ConfigStorageController.php @@ -8,8 +8,8 @@ namespace Drupal\config; use Drupal\Component\Uuid\Uuid; -use Drupal\entity\StorableInterface; -use Drupal\entity\StorageControllerInterface; +use Drupal\Core\Entity\StorableInterface; +use Drupal\Core\Entity\StorageControllerInterface; /** * Defines the storage controller class for configurable entities. @@ -49,7 +49,7 @@ class ConfigStorageController implements StorageControllerInterface { protected $idKey; /** - * Implements Drupal\entity\StorageControllerInterface::__construct(). + * Implements Drupal\Core\Entity\StorageControllerInterface::__construct(). * * Sets basic variables. */ @@ -64,7 +64,7 @@ public function __construct($entityType) { } /** - * Implements Drupal\entity\StorageControllerInterface::resetCache(). + * Implements Drupal\Core\Entity\StorageControllerInterface::resetCache(). */ public function resetCache(array $ids = NULL) { // The configuration system is fast enough and/or implements its own @@ -72,7 +72,7 @@ public function resetCache(array $ids = NULL) { } /** - * Implements Drupal\entity\StorageControllerInterface::load(). + * Implements Drupal\Core\Entity\StorageControllerInterface::load(). */ public function load(array $ids = NULL) { $entities = array(); @@ -111,14 +111,14 @@ public function load(array $ids = NULL) { } /** - * Implements Drupal\entity\StorageControllerInterface::loadRevision(). + * Implements Drupal\Core\Entity\StorageControllerInterface::loadRevision(). */ public function loadRevision($revision_id) { return FALSE; } /** - * Implements Drupal\entity\StorageControllerInterface::loadByProperties(). + * Implements Drupal\Core\Entity\StorageControllerInterface::loadByProperties(). */ public function loadByProperties(array $values = array()) { return array(); @@ -203,10 +203,10 @@ protected function attachLoad(&$queried_entities, $revision_id = FALSE) { } /** - * Implements Drupal\entity\StorageControllerInterface::create(). + * Implements Drupal\Core\Entity\StorageControllerInterface::create(). */ public function create(array $values) { - $class = isset($this->entityInfo['entity class']) ? $this->entityInfo['entity class'] : 'Drupal\entity\Entity'; + $class = isset($this->entityInfo['entity class']) ? $this->entityInfo['entity class'] : 'Drupal\Core\Entity\Entity'; $entity = new $class($values, $this->entityType); @@ -220,7 +220,7 @@ public function create(array $values) { } /** - * Implements Drupal\entity\StorageControllerInterface::delete(). + * Implements Drupal\Core\Entity\StorageControllerInterface::delete(). */ public function delete($ids) { $entities = $ids ? $this->load($ids) : FALSE; @@ -246,7 +246,7 @@ public function delete($ids) { } /** - * Implements Drupal\entity\StorageControllerInterface::save(). + * Implements Drupal\Core\Entity\StorageControllerInterface::save(). */ public function save(StorableInterface $entity) { $prefix = $this->entityInfo['config prefix'] . '.'; diff --git a/core/modules/config/lib/Drupal/config/ConfigurableBase.php b/core/modules/config/lib/Drupal/config/ConfigurableBase.php index a8bc318..b9fbc40 100644 --- a/core/modules/config/lib/Drupal/config/ConfigurableBase.php +++ b/core/modules/config/lib/Drupal/config/ConfigurableBase.php @@ -7,7 +7,7 @@ namespace Drupal\config; -use Drupal\entity\StorableBase; +use Drupal\Core\Entity\StorableBase; /** * Defines a base configurable entity class. diff --git a/core/modules/config/lib/Drupal/config/ConfigurableInterface.php b/core/modules/config/lib/Drupal/config/ConfigurableInterface.php index bf49b9b..006aee4 100644 --- a/core/modules/config/lib/Drupal/config/ConfigurableInterface.php +++ b/core/modules/config/lib/Drupal/config/ConfigurableInterface.php @@ -7,7 +7,7 @@ namespace Drupal\config; -use Drupal\entity\StorableInterface; +use Drupal\Core\Entity\StorableInterface; /** * Defines the interface common for all configurable entities. diff --git a/core/modules/entity/entity.api.php b/core/modules/entity/entity.api.php deleted file mode 100644 index 3b0d8e7..0000000 --- a/core/modules/entity/entity.api.php +++ /dev/null @@ -1,468 +0,0 @@ -subject, then - * 'subject' should be specified here. If complex logic is required to - * build the label, a 'label callback' should be defined instead (see - * the 'label callback' section above for details). - * - uuid (optional): The name of the property that contains the universally - * unique identifier of the entity, which is used to distinctly identify - * an entity across different systems. - * - bundle keys: An array describing how the Field API can extract the - * information it needs from the bundle objects for this type (e.g - * $vocabulary objects for terms; not applicable for nodes). This entry can - * be omitted if this type's bundles do not exist as standalone objects. - * Elements: - * - bundle: The name of the property that contains the name of the bundle - * object. - * - bundles: An array describing all bundles for this object type. Keys are - * bundles machine names, as found in the objects' 'bundle' property - * (defined in the 'entity keys' entry above). Elements: - * - label: The human-readable name of the bundle. - * - uri callback: Same as the 'uri callback' key documented above for the - * entity type, but for the bundle only. When determining the URI of an - * entity, if a 'uri callback' is defined for both the entity type and - * the bundle, the one for the bundle is used. - * - admin: An array of information that allows Field UI pages to attach - * themselves to the existing administration pages for the bundle. - * Elements: - * - path: the path of the bundle's main administration page, as defined - * in hook_menu(). If the path includes a placeholder for the bundle, - * the 'bundle argument', 'bundle helper' and 'real path' keys below - * are required. - * - bundle argument: The position of the placeholder in 'path', if any. - * - real path: The actual path (no placeholder) of the bundle's main - * administration page. This will be used to generate links. - * - access callback: As in hook_menu(). 'user_access' will be assumed if - * no value is provided. - * - access arguments: As in hook_menu(). - * - view modes: An array describing the view modes for the entity type. View - * modes let entities be displayed differently depending on the context. - * For instance, a node can be displayed differently on its own page - * ('full' mode), on the home page or taxonomy listings ('teaser' mode), or - * in an RSS feed ('rss' mode). Modules taking part in the display of the - * entity (notably the Field API) can adjust their behavior depending on - * the requested view mode. An additional 'default' view mode is available - * for all entity types. This view mode is not intended for actual entity - * display, but holds default display settings. For each available view - * mode, administrators can configure whether it should use its own set of - * field display settings, or just replicate the settings of the 'default' - * view mode, thus reducing the amount of display configurations to keep - * track of. Keys of the array are view mode names. Each view mode is - * described by an array with the following key/value pairs: - * - label: The human-readable name of the view mode - * - custom settings: A boolean specifying whether the view mode should by - * default use its own custom field display settings. If FALSE, entities - * displayed in this view mode will reuse the 'default' display settings - * by default (e.g. right after the module exposing the view mode is - * enabled), but administrators can later use the Field UI to apply custom - * display settings specific to the view mode. - * - * @see entity_load() - * @see entity_load_multiple() - * @see hook_entity_info_alter() - */ -function hook_entity_info() { - $return = array( - 'node' => array( - 'label' => t('Node'), - 'entity class' => 'Drupal\node\Node', - 'controller class' => 'Drupal\node\NodeStorageController', - 'form controller class' => array( - 'default' => 'Drupal\node\NodeFormController', - ), - 'base table' => 'node', - 'revision table' => 'node_revision', - 'uri callback' => 'node_uri', - 'fieldable' => TRUE, - 'translation' => array( - 'locale' => TRUE, - ), - 'entity keys' => array( - 'id' => 'nid', - 'revision' => 'vid', - 'bundle' => 'type', - 'uuid' => 'uuid', - ), - 'bundle keys' => array( - 'bundle' => 'type', - ), - 'bundles' => array(), - 'view modes' => array( - 'full' => array( - 'label' => t('Full content'), - 'custom settings' => FALSE, - ), - 'teaser' => array( - 'label' => t('Teaser'), - 'custom settings' => TRUE, - ), - 'rss' => array( - 'label' => t('RSS'), - 'custom settings' => FALSE, - ), - ), - ), - ); - - // Search integration is provided by node.module, so search-related - // view modes for nodes are defined here and not in search.module. - if (module_exists('search')) { - $return['node']['view modes'] += array( - 'search_index' => array( - 'label' => t('Search index'), - 'custom settings' => FALSE, - ), - 'search_result' => array( - 'label' => t('Search result'), - 'custom settings' => FALSE, - ), - ); - } - - // Bundles must provide a human readable name so we can create help and error - // messages, and the path to attach Field admin pages to. - foreach (node_type_get_names() as $type => $name) { - $return['node']['bundles'][$type] = array( - 'label' => $name, - 'admin' => array( - 'path' => 'admin/structure/types/manage/%node_type', - 'real path' => 'admin/structure/types/manage/' . $type, - 'bundle argument' => 4, - 'access arguments' => array('administer content types'), - ), - ); - } - - return $return; -} - -/** - * Alter the entity info. - * - * Modules may implement this hook to alter the information that defines an - * entity. All properties that are available in hook_entity_info() can be - * altered here. - * - * @param $entity_info - * The entity info array, keyed by entity name. - * - * @see hook_entity_info() - */ -function hook_entity_info_alter(&$entity_info) { - // Set the controller class for nodes to an alternate implementation of the - // Drupal\entity\StorageControllerInterface interface. - $entity_info['node']['controller class'] = 'Drupal\mymodule\MyCustomNodeStorageController'; -} - -/** - * Act on entities when loaded. - * - * This is a generic load hook called for all entity types loaded via the - * entity API. - * - * @param array $entities - * The entities keyed by entity ID. - * @param string $entity_type - * The type of entities being loaded (i.e. node, user, comment). - */ -function hook_entity_load($entities, $entity_type) { - foreach ($entities as $entity) { - $entity->foo = mymodule_add_something($entity); - } -} - -/** - * Act on an entity before it is about to be created or updated. - * - * @param Drupal\entity\EntityInterface $entity - * The entity object. - */ -function hook_entity_presave(Drupal\entity\EntityInterface $entity) { - $entity->changed = REQUEST_TIME; -} - -/** - * Act on entities when inserted. - * - * @param Drupal\entity\EntityInterface $entity - * The entity object. - */ -function hook_entity_insert(Drupal\entity\EntityInterface $entity) { - // Insert the new entity into a fictional table of all entities. - db_insert('example_entity') - ->fields(array( - 'type' => $entity->entityType(), - 'id' => $entity->id(), - 'created' => REQUEST_TIME, - 'updated' => REQUEST_TIME, - )) - ->execute(); -} - -/** - * Act on entities when updated. - * - * @param Drupal\entity\EntityInterface $entity - * The entity object. - */ -function hook_entity_update(Drupal\entity\EntityInterface $entity) { - // Update the entity's entry in a fictional table of all entities. - db_update('example_entity') - ->fields(array( - 'updated' => REQUEST_TIME, - )) - ->condition('type', $entity->entityType()) - ->condition('id', $entity->id()) - ->execute(); -} - -/** - * Act before entity deletion. - * - * This hook runs after the entity type-specific predelete hook. - * - * @param Drupal\entity\EntityInterface $entity - * The entity object for the entity that is about to be deleted. - */ -function hook_entity_predelete(Drupal\entity\EntityInterface $entity) { - // Count references to this entity in a custom table before they are removed - // upon entity deletion. - $id = $entity->id(); - $type = $entity->entityType(); - $count = db_select('example_entity_data') - ->condition('type', $type) - ->condition('id', $id) - ->countQuery() - ->execute() - ->fetchField(); - - // Log the count in a table that records this statistic for deleted entities. - $ref_count_record = (object) array( - 'count' => $count, - 'type' => $type, - 'id' => $id, - ); - drupal_write_record('example_deleted_entity_statistics', $ref_count_record); -} - -/** - * Respond to entity deletion. - * - * This hook runs after the entity type-specific delete hook. - * - * @param Drupal\entity\EntityInterface $entity - * The entity object for the entity that has been deleted. - */ -function hook_entity_delete(Drupal\entity\EntityInterface $entity) { - // Delete the entity's entry from a fictional table of all entities. - db_delete('example_entity') - ->condition('type', $entity->entityType()) - ->condition('id', $entity->id()) - ->execute(); -} - -/** - * Alter or execute an Drupal\entity\EntityFieldQuery. - * - * @param Drupal\entity\EntityFieldQuery $query - * An EntityFieldQuery. One of the most important properties to be changed is - * EntityFieldQuery::executeCallback. If this is set to an existing function, - * this function will get the query as its single argument and its result - * will be the returned as the result of EntityFieldQuery::execute(). This can - * be used to change the behavior of EntityFieldQuery entirely. For example, - * the default implementation can only deal with one field storage engine, but - * it is possible to write a module that can query across field storage - * engines. Also, the default implementation presumes entities are stored in - * SQL, but the execute callback could instead query any other entity storage, - * local or remote. - * - * Note the $query->altered attribute which is TRUE in case the query has - * already been altered once. This happens with cloned queries. - * If there is a pager, then such a cloned query will be executed to count - * all elements. This query can be detected by checking for - * ($query->pager && $query->count), allowing the driver to return 0 from - * the count query and disable the pager. - */ -function hook_entity_query_alter(Drupal\entity\EntityFieldQuery $query) { - $query->executeCallback = 'my_module_query_callback'; -} - -/** - * Act on entities being assembled before rendering. - * - * @param Drupal\entity\EntityInterface $entity - * The entity object. - * @param $view_mode - * The view mode the entity is rendered in. - * @param $langcode - * The language code used for rendering. - * - * The module may add elements to $entity->content prior to rendering. The - * structure of $entity->content is a renderable array as expected by - * drupal_render(). - * - * @see hook_entity_view_alter() - * @see hook_comment_view() - * @see hook_node_view() - * @see hook_user_view() - */ -function hook_entity_view(Drupal\entity\EntityInterface $entity, $view_mode, $langcode) { - $entity->content['my_additional_field'] = array( - '#markup' => $additional_field, - '#weight' => 10, - '#theme' => 'mymodule_my_additional_field', - ); -} - -/** - * Alter the results of ENTITY_view(). - * - * This hook is called after the content has been assembled in a structured - * array and may be used for doing processing which requires that the complete - * entity content structure has been built. - * - * If a module wishes to act on the rendered HTML of the entity rather than the - * structured content array, it may use this hook to add a #post_render - * callback. Alternatively, it could also implement hook_preprocess_HOOK() for - * the particular entity type template, if there is one (e.g., node.tpl.php). - * See drupal_render() and theme() for details. - * - * @param $build - * A renderable array representing the entity content. - * @param Drupal\entity\EntityInterface $entity - * The entity object being rendered. - * - * @see hook_entity_view() - * @see hook_comment_view_alter() - * @see hook_node_view_alter() - * @see hook_taxonomy_term_view_alter() - * @see hook_user_view_alter() - */ -function hook_entity_view_alter(&$build, Drupal\entity\EntityInterface $entity) { - if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) { - // Change its weight. - $build['an_additional_field']['#weight'] = -10; - - // Add a #post_render callback to act on the rendered HTML of the entity. - $build['#post_render'][] = 'my_module_node_post_render'; - } -} - -/** - * Act on entities as they are being prepared for view. - * - * Allows you to operate on multiple entities as they are being prepared for - * view. Only use this if attaching the data during the entity loading phase - * is not appropriate, for example when attaching other 'entity' style objects. - * - * @param array $entities - * The entities keyed by entity ID. - * @param string $entity_type - * The type of entities being viewed (i.e. node, user, comment). - */ -function hook_entity_prepare_view($entities, $entity_type) { - // Load a specific node into the user object for later theming. - if (!empty($entities) && $entity_type == 'user') { - $nodes = mymodule_get_user_nodes(array_keys($entities)); - foreach ($entities as $uid => $entity) { - $entity->user_node = $nodes[$uid]; - } - } -} - -/** - * Change the view mode of an entity that is being displayed. - * - * @param string $view_mode - * The view_mode that is to be used to display the entity. - * @param Drupal\entity\EntityInterface $entity - * The entity that is being viewed. - * @param array $context - * Array with additional context information, currently only contains the - * langcode the entity is viewed in. - */ -function hook_entity_view_mode_alter(&$view_mode, Drupal\entity\EntityInterface $entity, $context) { - // For nodes, change the view mode when it is teaser. - if ($entity->entityType() == 'node' && $view_mode == 'teaser') { - $view_mode = 'my_custom_view_mode'; - } -} diff --git a/core/modules/entity/entity.info b/core/modules/entity/entity.info deleted file mode 100644 index 21bb5a3..0000000 --- a/core/modules/entity/entity.info +++ /dev/null @@ -1,6 +0,0 @@ -name = Entity -description = API for managing entities like nodes and users. -package = Core -version = VERSION -core = 8.x -required = TRUE diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index d77eca1..72c5709 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -1937,18 +1937,18 @@ function hook_field_storage_delete_revision($entity_type, $entity, $fields) { } /** - * Execute a Drupal\entity\EntityFieldQuery. + * Execute a Drupal\Core\Entity\EntityFieldQuery. * * This hook is called to find the entities having certain entity and field * conditions and sort them in the given field order. If the field storage * engine also handles property sorts and orders, it should unset those * properties in the called object to signal that those have been handled. * - * @param Drupal\entity\EntityFieldQuery $query + * @param Drupal\Core\Entity\EntityFieldQuery $query * An EntityFieldQuery. * * @return - * See Drupal\entity\EntityFieldQuery::execute() for the return values. + * See Drupal\Core\Entity\EntityFieldQuery::execute() for the return values. */ function hook_field_storage_query($query) { $groups = array(); diff --git a/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc index 611b577..7c2acdb 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -6,7 +6,7 @@ */ use Drupal\field\FieldValidationException; -use Drupal\entity\EntityInterface; +use Drupal\Core\Entity\EntityInterface; /** * @defgroup field_storage Field Storage API @@ -123,7 +123,7 @@ * - prepare translation * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The fully formed $entity_type entity. * @param $a * - The $form in the 'form' operation. @@ -519,7 +519,7 @@ function _field_invoke_get_instances($entity_type, $bundle, $options) { * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity for which to load form elements, used to initialize * default form values. * @param $form @@ -739,7 +739,7 @@ function field_attach_load_revision($entity_type, $entities, $options = array()) * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity with fields to validate. * @throws Drupal\field\FieldValidationException * If validation errors are found, a FieldValidationException is thrown. The @@ -784,7 +784,7 @@ function field_attach_validate($entity_type, $entity) { * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity being submitted. The 'bundle', 'id' and (if applicable) * 'revision' keys should be present. The actual field values will be read * from $form_state['values']. @@ -824,7 +824,7 @@ function field_attach_form_validate($entity_type, EntityInterface $entity, $form * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity being submitted. The 'bundle', 'id' and (if applicable) * 'revision' keys should be present. The actual field values will be read * from $form_state['values']. @@ -876,7 +876,7 @@ function field_attach_presave($entity_type, $entity) { * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity with fields to save. * @return * Default values (if any) will be added to the $entity parameter for fields @@ -925,7 +925,7 @@ function field_attach_insert($entity_type, EntityInterface $entity) { * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity with fields to save. */ function field_attach_update($entity_type, EntityInterface $entity) { @@ -978,7 +978,7 @@ function field_attach_update($entity_type, EntityInterface $entity) { * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity whose field data to delete. */ function field_attach_delete($entity_type, $entity) { @@ -1013,7 +1013,7 @@ function field_attach_delete($entity_type, $entity) { * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity with fields to save. */ function field_attach_delete_revision($entity_type, $entity) { @@ -1128,7 +1128,7 @@ function field_attach_prepare_view($entity_type, $entities, $view_mode, $langcod * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity with fields to render. * @param $view_mode * View mode, e.g. 'full', 'teaser'... @@ -1181,7 +1181,7 @@ function field_attach_view($entity_type, EntityInterface $entity, $view_mode, $l * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity with fields to render. * @param $element * The structured array containing the values ready for rendering. @@ -1221,7 +1221,7 @@ function field_attach_preprocess($entity_type, EntityInterface $entity, $element * * @param $entity_type * The type of $entity; e.g. 'node' or 'user'. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity to be prepared for translation. * @param $langcode * The language the entity has to be translated in. diff --git a/core/modules/field/field.crud.inc b/core/modules/field/field.crud.inc index b748c51..f1e5481 100644 --- a/core/modules/field/field.crud.inc +++ b/core/modules/field/field.crud.inc @@ -6,7 +6,7 @@ */ use Drupal\field\FieldException; -use Drupal\entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQuery; /** * @defgroup field_crud Field CRUD API diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 8157971..f3ddc8a 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -4,7 +4,7 @@ * Attach custom data fields to Drupal entities. */ -use Drupal\entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQuery; /* * Load all public Field API functions. Drupal currently has no diff --git a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php index 8021673..84b6f06 100644 --- a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php @@ -7,7 +7,7 @@ namespace Drupal\field\Tests; -use Drupal\entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQuery; /** * Unit test class for field bulk delete and batch purge functionality. diff --git a/core/modules/field/modules/field_sql_storage/field_sql_storage.module b/core/modules/field/modules/field_sql_storage/field_sql_storage.module index 69e8bda..90a9e72 100644 --- a/core/modules/field/modules/field_sql_storage/field_sql_storage.module +++ b/core/modules/field/modules/field_sql_storage/field_sql_storage.module @@ -7,8 +7,8 @@ use Drupal\Core\Database\Database; use Drupal\Core\Database\Query\Select; -use Drupal\entity\EntityFieldQuery; -use Drupal\entity\EntityFieldQueryException; +use Drupal\Core\Entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQueryException; use Drupal\field\FieldUpdateForbiddenException; /** @@ -612,7 +612,7 @@ function _field_sql_storage_query_join_entity(Select $select_query, $entity_type /** * Adds field (meta) conditions to the given query objects respecting groupings. * - * @param Drupal\entity\EntityFieldQuery $query + * @param Drupal\Core\Entity\EntityFieldQuery $query * The field query object to be processed. * @param SelectQuery $select_query * The SelectQuery that should get grouping conditions. diff --git a/core/modules/field/modules/options/options.module b/core/modules/field/modules/options/options.module index 3cda56b..4d70277 100644 --- a/core/modules/field/modules/options/options.module +++ b/core/modules/field/modules/options/options.module @@ -6,7 +6,7 @@ */ use Drupal\field\FieldUpdateForbiddenException; -use Drupal\entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQuery; /** * Implements hook_help(). diff --git a/core/modules/field/tests/modules/field_test/field_test.entity.inc b/core/modules/field/tests/modules/field_test/field_test.entity.inc index 9283bfe..7bb3b10 100644 --- a/core/modules/field/tests/modules/field_test/field_test.entity.inc +++ b/core/modules/field/tests/modules/field_test/field_test.entity.inc @@ -5,7 +5,7 @@ * Defines an entity type. */ -use Drupal\entity\EntityInterface; +use Drupal\Core\Entity\EntityInterface; /** * Implements hook_entity_info(). diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module index ea38362..92173a5 100644 --- a/core/modules/field/tests/modules/field_test/field_test.module +++ b/core/modules/field/tests/modules/field_test/field_test.module @@ -13,7 +13,7 @@ * test helper functions */ -use Drupal\entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQuery; require_once DRUPAL_ROOT . '/core/modules/field/tests/modules/field_test/field_test.entity.inc'; require_once DRUPAL_ROOT . '/core/modules/field/tests/modules/field_test/field_test.field.inc'; @@ -278,7 +278,7 @@ function field_test_field_widget_form_alter(&$element, &$form_state, $context) { /** * Implements hook_query_TAG_alter() for tag 'efq_table_prefixing_test'. * - * @see Drupal\entity\Tests\EntityFieldQueryTest::testTablePrefixing() + * @see Drupal\Core\Entity\Tests\EntityFieldQueryTest::testTablePrefixing() */ function field_test_query_efq_table_prefixing_test_alter(&$query) { // Add an additional join onto the entity base table. This will cause an diff --git a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntity.php b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntity.php index fb1335b..18cfff5 100644 --- a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntity.php +++ b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntity.php @@ -7,7 +7,7 @@ namespace Drupal\field_test; -use Drupal\entity\Entity; +use Drupal\Core\Entity\Entity; /** * Test entity class. @@ -36,21 +36,21 @@ class TestEntity extends Entity { public $fttype; /** - * Overrides Drupal\entity\Entity::id(). + * Overrides Drupal\Core\Entity\Entity::id(). */ public function id() { return $this->ftid; } /** - * Overrides Drupal\entity\Entity::getRevisionId(). + * Overrides Drupal\Core\Entity\Entity::getRevisionId(). */ public function getRevisionId() { return $this->ftvid; } /** - * Overrides Drupal\entity\Entity::bundle(). + * Overrides Drupal\Core\Entity\Entity::bundle(). */ public function bundle() { return !empty($this->fttype) ? $this->fttype : $this->entityType(); diff --git a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntityController.php b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntityController.php index 49129ca..75071c8 100644 --- a/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntityController.php +++ b/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/TestEntityController.php @@ -7,8 +7,8 @@ namespace Drupal\field_test; -use Drupal\entity\DatabaseStorageController; -use Drupal\entity\StorableInterface; +use Drupal\Core\Entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; /** * Controller class for the test entity entity types. @@ -16,7 +16,7 @@ class TestEntityController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::preSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::preSave(). */ public function preSave(StorableInterface $entity) { // Prepare for a new revision. @@ -27,7 +27,7 @@ public function preSave(StorableInterface $entity) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postSave(). */ public function postSave(StorableInterface $entity, $update) { // Only the test_entity entity type has revisions. diff --git a/core/modules/file/file.api.php b/core/modules/file/file.api.php index 71039b1..73429c1 100644 --- a/core/modules/file/file.api.php +++ b/core/modules/file/file.api.php @@ -14,7 +14,7 @@ * * @param $field * The field to which the file belongs. - * @param Drupal\entity\EntityInterface $entity + * @param Drupal\Core\Entity\EntityInterface $entity * The entity which references the file. * @param Drupal\Core\File\File $file * The file entity that is being requested. @@ -26,7 +26,7 @@ * * @see hook_field_access(). */ -function hook_file_download_access($field, Drupal\entity\EntityInterface $entity, Drupal\Core\File\File $file) { +function hook_file_download_access($field, Drupal\Core\Entity\EntityInterface $entity, Drupal\Core\File\File $file) { if ($entity->entityType() == 'node') { return node_access('view', $entity); } diff --git a/core/modules/file/file.module b/core/modules/file/file.module index d2f6f76..0b3b9f1 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -5,7 +5,7 @@ * Defines a "managed_file" Form API field and a "file" field for Field module. */ -use Drupal\entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQuery; use Drupal\Core\File\File; use Symfony\Component\HttpFoundation\JsonResponse; diff --git a/core/modules/file/tests/file_module_test.module b/core/modules/file/tests/file_module_test.module index f61d67d..657337d 100644 --- a/core/modules/file/tests/file_module_test.module +++ b/core/modules/file/tests/file_module_test.module @@ -5,7 +5,7 @@ * Provides File module pages for testing purposes. */ -use Drupal\entity\EntityInterface; +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\File\File; /** diff --git a/core/modules/node/lib/Drupal/node/Node.php b/core/modules/node/lib/Drupal/node/Node.php index fd3454e..85511a1 100644 --- a/core/modules/node/lib/Drupal/node/Node.php +++ b/core/modules/node/lib/Drupal/node/Node.php @@ -7,7 +7,7 @@ namespace Drupal\node; -use Drupal\entity\Entity; +use Drupal\Core\Entity\Entity; /** * Defines the node entity class. @@ -152,21 +152,21 @@ class Node extends Entity { public $revision_uid; /** - * Implements Drupal\entity\EntityInterface::id(). + * Implements Drupal\Core\Entity\EntityInterface::id(). */ public function id() { return $this->nid; } /** - * Implements Drupal\entity\EntityInterface::bundle(). + * Implements Drupal\Core\Entity\EntityInterface::bundle(). */ public function bundle() { return $this->type; } /** - * Overrides Drupal\entity\Entity::createDuplicate(). + * Overrides Drupal\Core\Entity\Entity::createDuplicate(). */ public function createDuplicate() { $duplicate = parent::createDuplicate(); @@ -175,7 +175,7 @@ public function createDuplicate() { } /** - * Overrides Drupal\entity\Entity::getRevisionId(). + * Overrides Drupal\Core\Entity\Entity::getRevisionId(). */ public function getRevisionId() { return $this->vid; diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index 51f4308..f23e1f6 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -7,8 +7,8 @@ namespace Drupal\node; -use Drupal\entity\EntityInterface; -use Drupal\entity\EntityFormController; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityFormController; /** * Form controller for the node edit forms. @@ -21,7 +21,7 @@ class NodeFormController extends EntityFormController { * Fills in a few default values, and then invokes hook_prepare() on the node * type module, and hook_node_prepare() on all modules. * - * Overrides Drupal\entity\EntityFormController::prepareEntity(). + * Overrides Drupal\Core\Entity\EntityFormController::prepareEntity(). */ protected function prepareEntity(EntityInterface $node) { // Set up default values, if required. @@ -51,7 +51,7 @@ protected function prepareEntity(EntityInterface $node) { } /** - * Overrides Drupal\entity\EntityFormController::form(). + * Overrides Drupal\Core\Entity\EntityFormController::form(). */ public function form(array $form, array &$form_state, EntityInterface $node) { $user_config = config('user.settings'); @@ -243,7 +243,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) { } /** - * Overrides Drupal\entity\EntityFormController::actions(). + * Overrides Drupal\Core\Entity\EntityFormController::actions(). */ protected function actions(array $form, array &$form_state) { $element = parent::actions($form, $form_state); @@ -269,7 +269,7 @@ protected function actions(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::validate(). + * Overrides Drupal\Core\Entity\EntityFormController::validate(). */ public function validate(array $form, array &$form_state) { $node = $this->buildEntity($form, $form_state); @@ -314,7 +314,7 @@ public function validate(array $form, array &$form_state) { * form state's entity with the current step's values before proceeding to the * next step. * - * Overrides Drupal\entity\EntityFormController::submit(). + * Overrides Drupal\Core\Entity\EntityFormController::submit(). */ public function submit(array $form, array &$form_state) { $this->submitNodeLanguage($form, $form_state); @@ -369,7 +369,7 @@ public function preview(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::save(). + * Overrides Drupal\Core\Entity\EntityFormController::save(). */ public function save(array $form, array &$form_state) { $node = $this->getEntity($form_state); @@ -405,7 +405,7 @@ public function save(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::delete(). + * Overrides Drupal\Core\Entity\EntityFormController::delete(). */ public function delete(array $form, array &$form_state) { $destination = array(); diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php index ee47546..aa3c94a 100644 --- a/core/modules/node/lib/Drupal/node/NodeStorageController.php +++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php @@ -7,21 +7,21 @@ namespace Drupal\node; -use Drupal\entity\DatabaseStorageController; -use Drupal\entity\StorableInterface; -use Drupal\entity\EntityStorageException; +use Drupal\Core\Entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; +use Drupal\Core\Entity\EntityStorageException; use Exception; /** * Controller class for nodes. * - * This extends the Drupal\entity\DatabaseStorageController class, adding + * This extends the Drupal\Core\Entity\DatabaseStorageController class, adding * required special handling for node entities. */ class NodeStorageController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::create(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::create(). */ public function create(array $values) { $node = parent::create($values); @@ -35,7 +35,7 @@ public function create(array $values) { } /** - * Overrides Drupal\entity\DatabaseStorageController::delete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::delete(). */ public function delete($ids) { $entities = $ids ? $this->load($ids) : FALSE; @@ -80,7 +80,7 @@ public function delete($ids) { } /** - * Overrides Drupal\entity\DatabaseStorageController::save(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::save(). */ public function save(StorableInterface $entity) { $transaction = db_transaction(); @@ -129,7 +129,7 @@ public function save(StorableInterface $entity) { /** * Saves a node revision. * - * @param Drupal\entity\StorableInterface $node + * @param Drupal\Core\Entity\StorableInterface $node * The node entity. */ protected function saveRevision(StorableInterface $entity) { @@ -155,7 +155,7 @@ protected function saveRevision(StorableInterface $entity) { } /** - * Overrides Drupal\entity\DatabaseStorageController::attachLoad(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::attachLoad(). */ protected function attachLoad(&$nodes, $load_revision = FALSE) { // Create an array of nodes for each content type and pass this to the @@ -180,7 +180,7 @@ protected function attachLoad(&$nodes, $load_revision = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::buildQuery(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::buildQuery(). */ protected function buildQuery($ids, $revision_id = FALSE) { // Ensure that uid is taken from the {node} table, @@ -195,7 +195,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::invokeHook(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::invokeHook(). */ protected function invokeHook($hook, StorableInterface $node) { if ($hook == 'insert' || $hook == 'update') { @@ -244,7 +244,7 @@ protected function invokeHook($hook, StorableInterface $node) { } /** - * Overrides Drupal\entity\DatabaseStorageController::preSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::preSave(). */ protected function preSave(StorableInterface $node) { // Before saving the node, set changed and revision times. @@ -260,14 +260,14 @@ protected function preSave(StorableInterface $node) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postSave(). */ function postSave(StorableInterface $node, $update) { node_access_acquire_grants($node, $update); } /** - * Overrides Drupal\entity\DatabaseStorageController::preDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::preDelete(). */ function preDelete($entities) { if (module_exists('search')) { @@ -278,7 +278,7 @@ function preDelete($entities) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postDelete(). */ protected function postDelete($nodes) { // Delete values from other tables also referencing this node. diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index a73b851..8032d51 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -1,6 +1,6 @@ assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.'); - $this->assertEqual($info['controller class'], 'Drupal\entity\DatabaseStorageController', 'Entity controller class info is correct.'); + $this->assertEqual($info['controller class'], 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.'); } } diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php similarity index 97% rename from core/modules/entity/lib/Drupal/entity/Tests/EntityApiTest.php rename to core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php index e8d979f..4b6a94f 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityApiTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\Tests\EntityApiTest. + * Definition of Drupal\Core\Entity\Tests\EntityApiTest. */ -namespace Drupal\entity\Tests; +namespace Drupal\Core\Entity\Tests; use Drupal\simpletest\WebTestBase; diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php similarity index 99% rename from core/modules/entity/lib/Drupal/entity/Tests/EntityCrudHookTest.php rename to core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php index 5f7f577..6a581a8 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityCrudHookTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\Tests\EntityCrudHookTest. + * Definition of Drupal\Core\Entity\Tests\EntityCrudHookTest. */ -namespace Drupal\entity\Tests; +namespace Drupal\Core\Entity\Tests; use Drupal\simpletest\WebTestBase; diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityFieldQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldQueryTest.php similarity index 99% rename from core/modules/entity/lib/Drupal/entity/Tests/EntityFieldQueryTest.php rename to core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldQueryTest.php index 535e45d..b0d4198 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityFieldQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldQueryTest.php @@ -2,18 +2,18 @@ /** * @file - * Definition of Drupal\entity\Tests\EntityFieldQueryTest. + * Definition of Drupal\Core\Entity\Tests\EntityFieldQueryTest. */ -namespace Drupal\entity\Tests; +namespace Drupal\Core\Entity\Tests; use Drupal\simpletest\WebTestBase; -use Drupal\entity\EntityFieldQuery; -use Drupal\entity\EntityFieldQueryException; +use Drupal\Core\Entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQueryException; use stdClass; /** - * Tests Drupal\entity\EntityFieldQuery. + * Tests Drupal\Core\Entity\EntityFieldQuery. */ class EntityFieldQueryTest extends WebTestBase { diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php similarity index 99% rename from core/modules/entity/lib/Drupal/entity/Tests/EntityTranslationTest.php rename to core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php index 252e048..5fd938f 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\Tests\EntityTranslationTest. + * Definition of Drupal\Core\Entity\Tests\EntityTranslationTest. */ -namespace Drupal\entity\Tests; +namespace Drupal\Core\Entity\Tests; use Exception; use InvalidArgumentException; diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityUUIDTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php similarity index 95% rename from core/modules/entity/lib/Drupal/entity/Tests/EntityUUIDTest.php rename to core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php index e7607dc..e264247 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityUUIDTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUUIDTest.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\entity\Tests\EntityUUIDTest. + * Definition of Drupal\Core\Entity\Tests\EntityUUIDTest. */ -namespace Drupal\entity\Tests; +namespace Drupal\Core\Entity\Tests; use Drupal\Component\Uuid\Uuid; use Drupal\simpletest\WebTestBase; diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index de8a2ae..b6dce2f 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -4145,5 +4145,458 @@ function hook_filetransfer_info_alter(&$filetransfer_info) { } /** - * @} End of "addtogroup hooks". + * Inform the base system and the Field API about one or more entity types. + * + * Inform the system about one or more entity types (i.e., object types that + * can be loaded via entity_load() and, optionally, to which fields can be + * attached). + * + * @return + * An array whose keys are entity type names and whose values identify + * properties of those types that the system needs to know about: + * - label: The human-readable name of the type. + * - entity class: The name of the entity class, defaults to + * Drupal\Core\Entity\Entity. The entity class must implement EntityInterface. + * - controller class: The name of the class that is used to load the objects. + * The class has to implement the + * Drupal\Core\Entity\StorageControllerInterface interface. Leave blank + * to use the Drupal\Core\Entity\DatabaseStorageController implementation. + * - form controller class: An associative array where the keys are the names + * of the different form operations (such as creation, editing or deletion) + * and the values are the names of the controller classes. To facilitate + * supporting the case where an entity form varies only slightly between + * different operations, the name of the operation is passed also to the + * constructor of the form controller class. This way, one class can be used + * for multiple entity forms. + * - base table: (used by Drupal\Core\Entity\DatabaseStorageController) The + * name of the entity type's base table. + * - static cache: (used by Drupal\Core\Entity\DatabaseStorageController) + * FALSE to disable static caching of entities during a page request. + * Defaults to TRUE. + * - field cache: (used by Field API loading and saving of field data) FALSE + * to disable Field API's persistent cache of field data. Only recommended + * if a higher level persistent cache is available for the entity type. + * Defaults to TRUE. + * - uri callback: A function taking an entity as argument and returning the + * uri elements of the entity, e.g. 'path' and 'options'. The actual entity + * uri can be constructed by passing these elements to url(). + * - label callback: (optional) A function taking an entity and optional langcode + * argument, and returning the label of the entity. If langcode is omitted, the + * entity's default language is used. + * + * The entity label is the main string associated with an entity; for + * example, the title of a node or the subject of a comment. If there is an + * entity object property that defines the label, use the 'label' element + * of the 'entity keys' return value component to provide this information + * (see below). If more complex logic is needed to determine the label of + * an entity, you can instead specify a callback function here, which will + * be called to determine the entity label. See also the + * Drupal\Core\Entity\Entity::label() method, which implements this logic. + * - fieldable: Set to TRUE if you want your entity type to be fieldable. + * - translation: An associative array of modules registered as field + * translation handlers. Array keys are the module names, array values + * can be any data structure the module uses to provide field translation. + * Any empty value disallows the module to appear as a translation handler. + * - entity keys: An array describing how the Field API can extract the + * information it needs from the objects of the type. Elements: + * - id: The name of the property that contains the primary id of the + * entity. Every entity object passed to the Field API must have this + * property and its value must be numeric. + * - revision: The name of the property that contains the revision id of + * the entity. The Field API assumes that all revision ids are unique + * across all entities of a type. This entry can be omitted if the + * entities of this type are not versionable. + * - bundle: The name of the property that contains the bundle name for the + * entity. The bundle name defines which set of fields are attached to + * the entity (e.g. what nodes call "content type"). This entry can be + * omitted if this entity type exposes a single bundle (all entities have + * the same collection of fields). The name of this single bundle will be + * the same as the entity type. + * - label: The name of the property that contains the entity label. For + * example, if the entity's label is located in $entity->subject, then + * 'subject' should be specified here. If complex logic is required to + * build the label, a 'label callback' should be defined instead (see + * the 'label callback' section above for details). + * - uuid (optional): The name of the property that contains the universally + * unique identifier of the entity, which is used to distinctly identify + * an entity across different systems. + * - bundle keys: An array describing how the Field API can extract the + * information it needs from the bundle objects for this type (e.g + * $vocabulary objects for terms; not applicable for nodes). This entry can + * be omitted if this type's bundles do not exist as standalone objects. + * Elements: + * - bundle: The name of the property that contains the name of the bundle + * object. + * - bundles: An array describing all bundles for this object type. Keys are + * bundles machine names, as found in the objects' 'bundle' property + * (defined in the 'entity keys' entry above). Elements: + * - label: The human-readable name of the bundle. + * - uri callback: Same as the 'uri callback' key documented above for the + * entity type, but for the bundle only. When determining the URI of an + * entity, if a 'uri callback' is defined for both the entity type and + * the bundle, the one for the bundle is used. + * - admin: An array of information that allows Field UI pages to attach + * themselves to the existing administration pages for the bundle. + * Elements: + * - path: the path of the bundle's main administration page, as defined + * in hook_menu(). If the path includes a placeholder for the bundle, + * the 'bundle argument', 'bundle helper' and 'real path' keys below + * are required. + * - bundle argument: The position of the placeholder in 'path', if any. + * - real path: The actual path (no placeholder) of the bundle's main + * administration page. This will be used to generate links. + * - access callback: As in hook_menu(). 'user_access' will be assumed if + * no value is provided. + * - access arguments: As in hook_menu(). + * - view modes: An array describing the view modes for the entity type. View + * modes let entities be displayed differently depending on the context. + * For instance, a node can be displayed differently on its own page + * ('full' mode), on the home page or taxonomy listings ('teaser' mode), or + * in an RSS feed ('rss' mode). Modules taking part in the display of the + * entity (notably the Field API) can adjust their behavior depending on + * the requested view mode. An additional 'default' view mode is available + * for all entity types. This view mode is not intended for actual entity + * display, but holds default display settings. For each available view + * mode, administrators can configure whether it should use its own set of + * field display settings, or just replicate the settings of the 'default' + * view mode, thus reducing the amount of display configurations to keep + * track of. Keys of the array are view mode names. Each view mode is + * described by an array with the following key/value pairs: + * - label: The human-readable name of the view mode + * - custom settings: A boolean specifying whether the view mode should by + * default use its own custom field display settings. If FALSE, entities + * displayed in this view mode will reuse the 'default' display settings + * by default (e.g. right after the module exposing the view mode is + * enabled), but administrators can later use the Field UI to apply custom + * display settings specific to the view mode. + * + * @see entity_load() + * @see entity_load_multiple() + * @see hook_entity_info_alter() */ +function hook_entity_info() { + $return = array( + 'node' => array( + 'label' => t('Node'), + 'entity class' => 'Drupal\node\Node', + 'controller class' => 'Drupal\node\NodeStorageController', + 'form controller class' => array( + 'default' => 'Drupal\node\NodeFormController', + ), + 'base table' => 'node', + 'revision table' => 'node_revision', + 'uri callback' => 'node_uri', + 'fieldable' => TRUE, + 'translation' => array( + 'locale' => TRUE, + ), + 'entity keys' => array( + 'id' => 'nid', + 'revision' => 'vid', + 'bundle' => 'type', + 'uuid' => 'uuid', + ), + 'bundle keys' => array( + 'bundle' => 'type', + ), + 'bundles' => array(), + 'view modes' => array( + 'full' => array( + 'label' => t('Full content'), + 'custom settings' => FALSE, + ), + 'teaser' => array( + 'label' => t('Teaser'), + 'custom settings' => TRUE, + ), + 'rss' => array( + 'label' => t('RSS'), + 'custom settings' => FALSE, + ), + ), + ), + ); + + // Search integration is provided by node.module, so search-related + // view modes for nodes are defined here and not in search.module. + if (module_exists('search')) { + $return['node']['view modes'] += array( + 'search_index' => array( + 'label' => t('Search index'), + 'custom settings' => FALSE, + ), + 'search_result' => array( + 'label' => t('Search result'), + 'custom settings' => FALSE, + ), + ); + } + + // Bundles must provide a human readable name so we can create help and error + // messages, and the path to attach Field admin pages to. + foreach (node_type_get_names() as $type => $name) { + $return['node']['bundles'][$type] = array( + 'label' => $name, + 'admin' => array( + 'path' => 'admin/structure/types/manage/%node_type', + 'real path' => 'admin/structure/types/manage/' . $type, + 'bundle argument' => 4, + 'access arguments' => array('administer content types'), + ), + ); + } + + return $return; +} + +/** + * Alter the entity info. + * + * Modules may implement this hook to alter the information that defines an + * entity. All properties that are available in hook_entity_info() can be + * altered here. + * + * @param $entity_info + * The entity info array, keyed by entity name. + * + * @see hook_entity_info() + */ +function hook_entity_info_alter(&$entity_info) { + // Set the controller class for nodes to an alternate implementation of the + // Drupal\Core\Entity\StorageControllerInterface interface. + $entity_info['node']['controller class'] = 'Drupal\mymodule\MyCustomNodeStorageController'; +} + +/** + * Act on entities when loaded. + * + * This is a generic load hook called for all entity types loaded via the + * entity API. + * + * @param array $entities + * The entities keyed by entity ID. + * @param string $entity_type + * The type of entities being loaded (i.e. node, user, comment). + */ +function hook_entity_load($entities, $entity_type) { + foreach ($entities as $entity) { + $entity->foo = mymodule_add_something($entity); + } +} + +/** + * Act on an entity before it is about to be created or updated. + * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity object. + */ +function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) { + $entity->changed = REQUEST_TIME; +} + +/** + * Act on entities when inserted. + * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity object. + */ +function hook_entity_insert(Drupal\Core\Entity\EntityInterface $entity) { + // Insert the new entity into a fictional table of all entities. + db_insert('example_entity') + ->fields(array( + 'type' => $entity->entityType(), + 'id' => $entity->id(), + 'created' => REQUEST_TIME, + 'updated' => REQUEST_TIME, + )) + ->execute(); +} + +/** + * Act on entities when updated. + * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity object. + */ +function hook_entity_update(Drupal\Core\Entity\EntityInterface $entity) { + // Update the entity's entry in a fictional table of all entities. + db_update('example_entity') + ->fields(array( + 'updated' => REQUEST_TIME, + )) + ->condition('type', $entity->entityType()) + ->condition('id', $entity->id()) + ->execute(); +} + +/** + * Act before entity deletion. + * + * This hook runs after the entity type-specific predelete hook. + * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity object for the entity that is about to be deleted. + */ +function hook_entity_predelete(Drupal\Core\Entity\EntityInterface $entity) { + // Count references to this entity in a custom table before they are removed + // upon entity deletion. + $id = $entity->id(); + $type = $entity->entityType(); + $count = db_select('example_entity_data') + ->condition('type', $type) + ->condition('id', $id) + ->countQuery() + ->execute() + ->fetchField(); + + // Log the count in a table that records this statistic for deleted entities. + $ref_count_record = (object) array( + 'count' => $count, + 'type' => $type, + 'id' => $id, + ); + drupal_write_record('example_deleted_entity_statistics', $ref_count_record); +} + +/** + * Respond to entity deletion. + * + * This hook runs after the entity type-specific delete hook. + * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity object for the entity that has been deleted. + */ +function hook_entity_delete(Drupal\Core\Entity\EntityInterface $entity) { + // Delete the entity's entry from a fictional table of all entities. + db_delete('example_entity') + ->condition('type', $entity->entityType()) + ->condition('id', $entity->id()) + ->execute(); +} + +/** + * Alter or execute an Drupal\Core\Entity\EntityFieldQuery. + * + * @param Drupal\Core\Entity\EntityFieldQuery $query + * An EntityFieldQuery. One of the most important properties to be changed is + * EntityFieldQuery::executeCallback. If this is set to an existing function, + * this function will get the query as its single argument and its result + * will be the returned as the result of EntityFieldQuery::execute(). This can + * be used to change the behavior of EntityFieldQuery entirely. For example, + * the default implementation can only deal with one field storage engine, but + * it is possible to write a module that can query across field storage + * engines. Also, the default implementation presumes entities are stored in + * SQL, but the execute callback could instead query any other entity storage, + * local or remote. + * + * Note the $query->altered attribute which is TRUE in case the query has + * already been altered once. This happens with cloned queries. + * If there is a pager, then such a cloned query will be executed to count + * all elements. This query can be detected by checking for + * ($query->pager && $query->count), allowing the driver to return 0 from + * the count query and disable the pager. + */ +function hook_entity_query_alter(Drupal\Core\Entity\EntityFieldQuery $query) { + $query->executeCallback = 'my_module_query_callback'; +} + +/** + * Act on entities being assembled before rendering. + * + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity object. + * @param $view_mode + * The view mode the entity is rendered in. + * @param $langcode + * The language code used for rendering. + * + * The module may add elements to $entity->content prior to rendering. The + * structure of $entity->content is a renderable array as expected by + * drupal_render(). + * + * @see hook_entity_view_alter() + * @see hook_comment_view() + * @see hook_node_view() + * @see hook_user_view() + */ +function hook_entity_view(Drupal\Core\Entity\EntityInterface $entity, $view_mode, $langcode) { + $entity->content['my_additional_field'] = array( + '#markup' => $additional_field, + '#weight' => 10, + '#theme' => 'mymodule_my_additional_field', + ); +} + +/** + * Alter the results of ENTITY_view(). + * + * This hook is called after the content has been assembled in a structured + * array and may be used for doing processing which requires that the complete + * entity content structure has been built. + * + * If a module wishes to act on the rendered HTML of the entity rather than the + * structured content array, it may use this hook to add a #post_render + * callback. Alternatively, it could also implement hook_preprocess_HOOK() for + * the particular entity type template, if there is one (e.g., node.tpl.php). + * See drupal_render() and theme() for details. + * + * @param $build + * A renderable array representing the entity content. + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity object being rendered. + * + * @see hook_entity_view() + * @see hook_comment_view_alter() + * @see hook_node_view_alter() + * @see hook_taxonomy_term_view_alter() + * @see hook_user_view_alter() + */ +function hook_entity_view_alter(&$build, Drupal\Core\Entity\EntityInterface $entity) { + if ($build['#view_mode'] == 'full' && isset($build['an_additional_field'])) { + // Change its weight. + $build['an_additional_field']['#weight'] = -10; + + // Add a #post_render callback to act on the rendered HTML of the entity. + $build['#post_render'][] = 'my_module_node_post_render'; + } +} + +/** + * Act on entities as they are being prepared for view. + * + * Allows you to operate on multiple entities as they are being prepared for + * view. Only use this if attaching the data during the entity loading phase + * is not appropriate, for example when attaching other 'entity' style objects. + * + * @param array $entities + * The entities keyed by entity ID. + * @param string $entity_type + * The type of entities being viewed (i.e. node, user, comment). + */ +function hook_entity_prepare_view($entities, $entity_type) { + // Load a specific node into the user object for later theming. + if (!empty($entities) && $entity_type == 'user') { + $nodes = mymodule_get_user_nodes(array_keys($entities)); + foreach ($entities as $uid => $entity) { + $entity->user_node = $nodes[$uid]; + } + } +} + +/** + * Change the view mode of an entity that is being displayed. + * + * @param string $view_mode + * The view_mode that is to be used to display the entity. + * @param Drupal\Core\Entity\EntityInterface $entity + * The entity that is being viewed. + * @param array $context + * Array with additional context information, currently only contains the + * langcode the entity is viewed in. + */ +function hook_entity_view_mode_alter(&$view_mode, Drupal\Core\Entity\EntityInterface $entity, $context) { + // For nodes, change the view mode when it is teaser. + if ($entity->entityType() == 'node' && $view_mode == 'teaser') { + $view_mode = 'my_custom_view_mode'; + } +} diff --git a/core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.info b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.info similarity index 100% rename from core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.info rename to core/modules/system/tests/modules/entity_cache_test/entity_cache_test.info diff --git a/core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.module b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module similarity index 100% rename from core/modules/entity/tests/modules/entity_cache_test/entity_cache_test.module rename to core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module diff --git a/core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info similarity index 100% rename from core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info rename to core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.info diff --git a/core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module similarity index 100% rename from core/modules/entity/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module rename to core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module diff --git a/core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info b/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info similarity index 100% rename from core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info rename to core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.info diff --git a/core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module b/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module similarity index 99% rename from core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module rename to core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module index 48a2876..8a1e43c 100644 --- a/core/modules/entity/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module +++ b/core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module @@ -5,7 +5,7 @@ * Test module for the Entity CRUD API. */ -use Drupal\entity\EntityInterface; +use Drupal\Core\Entity\EntityInterface; /** * Implements hook_entity_presave(). diff --git a/core/modules/entity/tests/modules/entity_query_access_test/entity_query_access_test.info b/core/modules/system/tests/modules/entity_query_access_test/entity_query_access_test.info similarity index 100% rename from core/modules/entity/tests/modules/entity_query_access_test/entity_query_access_test.info rename to core/modules/system/tests/modules/entity_query_access_test/entity_query_access_test.info diff --git a/core/modules/entity/tests/modules/entity_query_access_test/entity_query_access_test.module b/core/modules/system/tests/modules/entity_query_access_test/entity_query_access_test.module similarity index 94% rename from core/modules/entity/tests/modules/entity_query_access_test/entity_query_access_test.module rename to core/modules/system/tests/modules/entity_query_access_test/entity_query_access_test.module index 262f3b7..2a4fd75 100644 --- a/core/modules/entity/tests/modules/entity_query_access_test/entity_query_access_test.module +++ b/core/modules/system/tests/modules/entity_query_access_test/entity_query_access_test.module @@ -5,8 +5,8 @@ * Helper module for testing EntityFieldQuery access on any type of entity. */ -use Drupal\entity\EntityFieldQuery; -use Drupal\entity\EntityFieldQueryException; +use Drupal\Core\Entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQueryException; /** * Implements hook_menu(). diff --git a/core/modules/entity/tests/modules/entity_test/entity_test.info b/core/modules/system/tests/modules/entity_test/entity_test.info similarity index 100% rename from core/modules/entity/tests/modules/entity_test/entity_test.info rename to core/modules/system/tests/modules/entity_test/entity_test.info diff --git a/core/modules/entity/tests/modules/entity_test/entity_test.install b/core/modules/system/tests/modules/entity_test/entity_test.install similarity index 100% rename from core/modules/entity/tests/modules/entity_test/entity_test.install rename to core/modules/system/tests/modules/entity_test/entity_test.install diff --git a/core/modules/entity/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module similarity index 100% rename from core/modules/entity/tests/modules/entity_test/entity_test.module rename to core/modules/system/tests/modules/entity_test/entity_test.module diff --git a/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTest.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTest.php similarity index 97% rename from core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTest.php rename to core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTest.php index 6c95f75..e112dcd 100644 --- a/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTest.php @@ -2,14 +2,14 @@ /** * @file - * Definition of Drupal\entity_test\EntityTest. + * Definition of Drupal\Core\Entity_test\EntityTest. */ -namespace Drupal\entity_test; +namespace Drupal\Core\Entity_test; use InvalidArgumentException; -use Drupal\entity\Entity; +use Drupal\Core\Entity\Entity; /** * Defines the test entity class. diff --git a/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php similarity index 85% rename from core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php rename to core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php index 4fac83c..ec6bc0f 100644 --- a/core/modules/entity/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestStorageController.php @@ -2,26 +2,26 @@ /** * @file - * Definition of Drupal\entity_test\EntityTestStorageController. + * Definition of Drupal\Core\Entity_test\EntityTestStorageController. */ -namespace Drupal\entity_test; +namespace Drupal\Core\Entity_test; use PDO; -use Drupal\entity\StorableInterface; -use Drupal\entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; +use Drupal\Core\Entity\DatabaseStorageController; /** * Defines the controller class for the test entity. * - * This extends the Drupal\entity\DatabaseStorageController class, adding + * This extends the Drupal\Core\Entity\DatabaseStorageController class, adding * required special handling for test entities. */ class EntityTestStorageController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::loadByProperties(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::loadByProperties(). */ public function loadByProperties(array $values) { $query = db_select($this->entityInfo['base table'], 'base'); @@ -58,7 +58,7 @@ public function loadByProperties(array $values) { } /** - * Overrides Drupal\entity\DatabaseStorageController::attachLoad(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::attachLoad(). */ protected function attachLoad(&$queried_entities, $load_revision = FALSE) { $data = db_select('entity_test_property_data', 'data', array('fetch' => PDO::FETCH_ASSOC)) @@ -82,7 +82,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postSave(). */ protected function postSave(StorableInterface $entity, $update) { $default_langcode = ($language = $entity->language()) ? $language->langcode : LANGUAGE_NOT_SPECIFIED; @@ -107,7 +107,7 @@ protected function postSave(StorableInterface $entity, $update) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postDelete(). */ protected function postDelete($entities) { db_delete('entity_test_property_data') diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Term.php index 929422c..64151cb 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Term.php @@ -7,7 +7,7 @@ namespace Drupal\taxonomy; -use Drupal\entity\Entity; +use Drupal\Core\Entity\Entity; /** * Defines the taxonomy term entity. @@ -91,14 +91,14 @@ class Term extends Entity { public $vocabulary_machine_name; /** - * Implements Drupal\entity\EntityInterface::id(). + * Implements Drupal\Core\Entity\EntityInterface::id(). */ public function id() { return $this->tid; } /** - * Implements Drupal\entity\EntityInterface::bundle(). + * Implements Drupal\Core\Entity\EntityInterface::bundle(). */ public function bundle() { return $this->vocabulary_machine_name; diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php index dfa1c3f..c7ee415 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermFormController.php @@ -7,8 +7,8 @@ namespace Drupal\taxonomy; -use Drupal\entity\EntityInterface; -use Drupal\entity\EntityFormController; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityFormController; /** * Base for controller for taxonomy term edit forms. @@ -16,7 +16,7 @@ class TermFormController extends EntityFormController { /** - * Overrides Drupal\entity\EntityFormController::form(). + * Overrides Drupal\Core\Entity\EntityFormController::form(). */ public function form(array $form, array &$form_state, EntityInterface $term) { $vocabulary = taxonomy_vocabulary_load($term->vid); @@ -123,7 +123,7 @@ public function form(array $form, array &$form_state, EntityInterface $term) { } /** - * Overrides Drupal\entity\EntityFormController::validate(). + * Overrides Drupal\Core\Entity\EntityFormController::validate(). */ public function validate(array $form, array &$form_state) { parent::validate($form, $form_state); @@ -135,7 +135,7 @@ public function validate(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::submit(). + * Overrides Drupal\Core\Entity\EntityFormController::submit(). */ public function submit(array $form, array &$form_state) { $term = parent::submit($form, $form_state); @@ -152,7 +152,7 @@ public function submit(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::save(). + * Overrides Drupal\Core\Entity\EntityFormController::save(). */ public function save(array $form, array &$form_state) { $term = $this->getEntity($form_state); @@ -196,7 +196,7 @@ public function save(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::delete(). + * Overrides Drupal\Core\Entity\EntityFormController::delete(). */ public function delete(array $form, array &$form_state) { $destination = array(); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php index e90699d..6ca6633 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php @@ -7,8 +7,8 @@ namespace Drupal\taxonomy; -use Drupal\entity\StorableInterface; -use Drupal\entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; +use Drupal\Core\Entity\DatabaseStorageController; /** * Defines a Controller class for taxonomy terms. @@ -16,7 +16,7 @@ class TermStorageController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::create(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::create(). * * @param array $values * An array of values to set, keyed by property name. A value for the @@ -41,7 +41,7 @@ public function create(array $values) { } /** - * Overrides Drupal\entity\DatabaseStorageController::buildQuery(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::buildQuery(). */ protected function buildQuery($ids, $revision_id = FALSE) { $query = parent::buildQuery($ids, $revision_id); @@ -55,9 +55,9 @@ protected function buildQuery($ids, $revision_id = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::buildPropertyQuery(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::buildPropertyQuery(). */ - protected function buildPropertyQuery(\Drupal\entity\EntityFieldQuery $entity_query, array $values) { + protected function buildPropertyQuery(\Drupal\Core\Entity\EntityFieldQuery $entity_query, array $values) { if (isset($values['name'])) { $entity_query->propertyCondition('name', $values['name'], 'LIKE'); unset($values['name']); @@ -66,7 +66,7 @@ protected function buildPropertyQuery(\Drupal\entity\EntityFieldQuery $entity_qu } /** - * Overrides Drupal\entity\DatabaseStorageController::postDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postDelete(). */ protected function postDelete($entities) { // See if any of the term's children are about to be become orphans. @@ -97,7 +97,7 @@ protected function postDelete($entities) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postSave(). */ protected function postSave(StorableInterface $entity, $update) { if (isset($entity->parent)) { @@ -119,7 +119,7 @@ protected function postSave(StorableInterface $entity, $update) { } /** - * Overrides Drupal\entity\DatabaseStorageController::resetCache(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::resetCache(). */ public function resetCache(array $ids = NULL) { drupal_static_reset('taxonomy_term_count_nodes'); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php index 8fb20d0..7726dbf 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php @@ -7,7 +7,7 @@ namespace Drupal\taxonomy\Tests; -use Drupal\entity\EntityFieldQuery; +use Drupal\Core\Entity\EntityFieldQuery; /** * Tests the functionality of EntityFieldQuery for taxonomy entities. diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Vocabulary.php index 13f6bbf..e32f285 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Vocabulary.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Vocabulary.php @@ -7,7 +7,7 @@ namespace Drupal\taxonomy; -use Drupal\entity\Entity; +use Drupal\Core\Entity\Entity; /** * Defines the taxonomy vocabulary entity. @@ -62,7 +62,7 @@ class Vocabulary extends Entity { public $weight = 0; /** - * Implements Drupal\entity\EntityInterface::id(). + * Implements Drupal\Core\Entity\EntityInterface::id(). */ public function id() { return $this->vid; diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php index 667041e..bdeea4c 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php @@ -7,8 +7,8 @@ namespace Drupal\taxonomy; -use Drupal\entity\EntityInterface; -use Drupal\entity\EntityFormController; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityFormController; /** * Base form controller for vocabulary edit forms. @@ -16,7 +16,7 @@ class VocabularyFormController extends EntityFormController { /** - * Overrides Drupal\entity\EntityFormController::form(). + * Overrides Drupal\Core\Entity\EntityFormController::form(). */ public function form(array $form, array &$form_state, EntityInterface $vocabulary) { @@ -80,7 +80,7 @@ protected function actions(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::validate(). + * Overrides Drupal\Core\Entity\EntityFormController::validate(). */ public function validate(array $form, array &$form_state) { parent::validate($form, $form_state); @@ -100,7 +100,7 @@ public function validate(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::submit(). + * Overrides Drupal\Core\Entity\EntityFormController::submit(). */ public function submit(array $form, array &$form_state) { // @todo We should not be calling taxonomy_vocabulary_confirm_delete() from @@ -117,7 +117,7 @@ public function submit(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::save(). + * Overrides Drupal\Core\Entity\EntityFormController::save(). */ public function save(array $form, array &$form_state) { $vocabulary = $this->getEntity($form_state); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php index 77f5ce7..116eed2 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php @@ -7,8 +7,8 @@ namespace Drupal\taxonomy; -use Drupal\entity\StorableInterface; -use Drupal\entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; +use Drupal\Core\Entity\DatabaseStorageController; /** * Defines a controller class for taxonomy vocabularies. @@ -16,7 +16,7 @@ class VocabularyStorageController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::buildQuery(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::buildQuery(). */ protected function buildQuery($ids, $revision_id = FALSE) { $query = parent::buildQuery($ids, $revision_id); @@ -27,7 +27,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postSave(). */ protected function postSave(StorableInterface $entity, $update) { if (!$update) { @@ -39,7 +39,7 @@ protected function postSave(StorableInterface $entity, $update) { } /** - * Overrides Drupal\entity\DatabaseStorageController::preDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::preDelete(). */ protected function preDelete($entities) { // Only load terms without a parent, child terms will get deleted too. @@ -48,7 +48,7 @@ protected function preDelete($entities) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postDelete(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postDelete(). */ protected function postDelete($entities) { // Load all Taxonomy module fields and delete those which use only this @@ -79,7 +79,7 @@ protected function postDelete($entities) { } /** - * Overrides Drupal\entity\DrupalDatabaseStorageController::resetCache(). + * Overrides Drupal\Core\Entity\DrupalDatabaseStorageController::resetCache(). */ public function resetCache(array $ids = NULL) { drupal_static_reset('taxonomy_vocabulary_get_names'); diff --git a/core/modules/taxonomy/taxonomy.api.php b/core/modules/taxonomy/taxonomy.api.php index 2ef691f..78f03e6 100644 --- a/core/modules/taxonomy/taxonomy.api.php +++ b/core/modules/taxonomy/taxonomy.api.php @@ -1,6 +1,6 @@ getEntity($form_state); diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php index 77aa58b..6e4a260 100644 --- a/core/modules/user/lib/Drupal/user/RegisterFormController.php +++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php @@ -7,7 +7,7 @@ namespace Drupal\user; -use Drupal\entity\EntityInterface; +use Drupal\Core\Entity\EntityInterface; /** * Form controller for the user register forms. @@ -15,7 +15,7 @@ class RegisterFormController extends AccountFormController { /** - * Overrides Drupal\entity\EntityFormController::form(). + * Overrides Drupal\Core\Entity\EntityFormController::form(). */ public function form(array $form, array &$form_state, EntityInterface $account) { global $user; @@ -60,7 +60,7 @@ public function form(array $form, array &$form_state, EntityInterface $account) } /** - * Overrides Drupal\entity\EntityFormController::actions(). + * Overrides Drupal\Core\Entity\EntityFormController::actions(). */ protected function actions(array $form, array &$form_state) { $element = parent::actions($form, $form_state); @@ -69,7 +69,7 @@ protected function actions(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::submit(). + * Overrides Drupal\Core\Entity\EntityFormController::submit(). */ public function submit(array $form, array &$form_state) { $admin = $form_state['values']['administer_users']; @@ -91,7 +91,7 @@ public function submit(array $form, array &$form_state) { } /** - * Overrides Drupal\entity\EntityFormController::submit(). + * Overrides Drupal\Core\Entity\EntityFormController::submit(). */ public function save(array $form, array &$form_state) { $account = $this->getEntity($form_state); diff --git a/core/modules/user/lib/Drupal/user/User.php b/core/modules/user/lib/Drupal/user/User.php index 42f2d29..66a7ef4 100644 --- a/core/modules/user/lib/Drupal/user/User.php +++ b/core/modules/user/lib/Drupal/user/User.php @@ -7,7 +7,7 @@ namespace Drupal\user; -use Drupal\entity\Entity; +use Drupal\Core\Entity\Entity; /** * Defines the user entity class. @@ -143,7 +143,7 @@ class User extends Entity { public $roles = array(); /** - * Implements Drupal\entity\EntityInterface::id(). + * Implements Drupal\Core\Entity\EntityInterface::id(). */ public function id() { return $this->uid; diff --git a/core/modules/user/lib/Drupal/user/UserStorageController.php b/core/modules/user/lib/Drupal/user/UserStorageController.php index bb1d9d2..9fb6197 100644 --- a/core/modules/user/lib/Drupal/user/UserStorageController.php +++ b/core/modules/user/lib/Drupal/user/UserStorageController.php @@ -7,20 +7,20 @@ namespace Drupal\user; -use Drupal\entity\StorableInterface; -use Drupal\entity\EntityMalformedException; -use Drupal\entity\DatabaseStorageController; +use Drupal\Core\Entity\StorableInterface; +use Drupal\Core\Entity\EntityMalformedException; +use Drupal\Core\Entity\DatabaseStorageController; /** * Controller class for users. * - * This extends the Drupal\entity\DatabaseStorageController class, adding + * This extends the Drupal\Core\Entity\DatabaseStorageController class, adding * required special handling for user objects. */ class UserStorageController extends DatabaseStorageController { /** - * Overrides Drupal\entity\DatabaseStorageController::attachLoad(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::attachLoad(). */ function attachLoad(&$queried_users, $load_revision = FALSE) { // Build an array of user picture IDs so that these can be fetched later. @@ -60,7 +60,7 @@ function attachLoad(&$queried_users, $load_revision = FALSE) { } /** - * Overrides Drupal\entity\DatabaseStorageController::create(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::create(). */ public function create(array $values) { if (!isset($values['created'])) { @@ -73,7 +73,7 @@ public function create(array $values) { } /** - * Overrides Drupal\entity\DatabaseStorageController::save(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::save(). */ public function save(StorableInterface $entity) { if (empty($entity->uid)) { @@ -84,7 +84,7 @@ public function save(StorableInterface $entity) { } /** - * Overrides Drupal\entity\DatabaseStorageController::preSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::preSave(). */ protected function preSave(StorableInterface $entity) { // Update the user password if it has changed. @@ -158,7 +158,7 @@ protected function preSave(StorableInterface $entity) { } /** - * Overrides Drupal\entity\DatabaseStorageController::postSave(). + * Overrides Drupal\Core\Entity\DatabaseStorageController::postSave(). */ protected function postSave(StorableInterface $entity, $update) { diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php index 98b9887..660c06b 100644 --- a/core/modules/user/user.api.php +++ b/core/modules/user/user.api.php @@ -1,6 +1,6 @@