diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 31bbf42..a02bd2d 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -33,6 +33,11 @@ function entity_render_cache_clear() { * * @see \Drupal\Core\Entity\EntityManagerInterface::getBundleInfo() * @see \Drupal\Core\Entity\EntityManagerInterface::getAllBundleInfo() + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use the + * \Drupal::entityManager()->getBundleInfo($entity_type) to get the info of a + * known entity type and use \Drupal::entityManager()->getAllBundleInfo() for + * all bundles. */ function entity_get_bundles($entity_type = NULL) { if (isset($entity_type)) { @@ -60,6 +65,9 @@ function entity_get_bundles($entity_type = NULL) { * @see \Drupal\Core\Entity\EntityStorageInterface * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage * @see \Drupal\Core\Entity\Query\QueryInterface + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * \Drupal::entityManager()->getStorage($type)->load(); */ function entity_load($entity_type, $id, $reset = FALSE) { $controller = \Drupal::entityManager()->getStorage($entity_type); @@ -84,6 +92,9 @@ function entity_load($entity_type, $id, $reset = FALSE) { * @see \Drupal\Core\Entity\EntityManagerInterface * @see \Drupal\Core\Entity\EntityStorageInterface * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * \Drupal::entityManager()->getStorage($entity_type)->loadRevision($revision_id); */ function entity_revision_load($entity_type, $revision_id) { return \Drupal::entityManager() @@ -98,6 +109,9 @@ function entity_revision_load($entity_type, $revision_id) { * The entity type to load, e.g. node or user. * @param $revision_id * The revision ID to delete. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * \Drupal::entityManager()>getStorage($entity_type)>deleteRevision($revision_id); */ function entity_revision_delete($entity_type, $revision_id) { \Drupal::entityManager() @@ -138,6 +152,9 @@ function entity_revision_delete($entity_type, $revision_id) { * @see \Drupal\Core\Entity\EntityStorageInterface * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage * @see \Drupal\Core\Entity\Query\QueryInterface + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * \Drupal::entityManager()->getStorage($entity_type)->loadMultiple($ids); */ function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { $controller = \Drupal::entityManager()->getStorage($entity_type); @@ -159,6 +176,9 @@ function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { * @return array * An array of entity objects indexed by their IDs. Returns an empty array if * no matching entities are found. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * \Drupal::entityManager()->getStorage($entity_type)->loadByProperties($values); */ function entity_load_multiple_by_properties($entity_type, array $values) { return \Drupal::entityManager() @@ -181,6 +201,9 @@ function entity_load_multiple_by_properties($entity_type, array $values) { * * @return * The unchanged entity, or FALSE if the entity cannot be loaded. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * \Drupal::entityManager()->getStorage($entity_type)->loadUnchanged($id). */ function entity_load_unchanged($entity_type, $id) { return \Drupal::entityManager() @@ -195,6 +218,12 @@ function entity_load_unchanged($entity_type, $id) { * The type of the entity. * @param array $ids * An array of entity IDs of the entities to delete. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * EntityManager loadMultiple Method to delete multiple entities + * $controller = \Drupal::entityManager()->getStorage($entity_type); + * $entities = $controller->loadMultiple($ids); + * $controller->delete($entities); */ function entity_delete_multiple($entity_type, array $ids) { $controller = \Drupal::entityManager()->getStorage($entity_type); @@ -214,10 +243,9 @@ function entity_delete_multiple($entity_type, array $ids) { * @return \Drupal\Core\Entity\EntityInterface * A new entity object. * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 9.0.0. Use - * the ::create($values) method if the entity type is known or - * \Drupal::entityManager()->getStorage($entity_type)->create($values) if the - * entity type is variable. + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * EntityManager Create Method to create Entity. + * return \Drupal::entityManager()->getStorage($entity_type)->create($values); */ function entity_create($entity_type, array $values = array()) { return \Drupal::entityManager() @@ -242,6 +270,9 @@ function entity_create($entity_type, array $values = array()) { * The label of the entity, or NULL if there is no label defined. * * @see \Drupal\Core\Entity\EntityInterface::label() + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * Use $entity->label($langcode); */ function entity_page_label(EntityInterface $entity, $langcode = NULL) { return $entity->label($langcode); @@ -263,6 +294,12 @@ function entity_page_label(EntityInterface $entity, $langcode = NULL) { * * @return array * A render array for the entity. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * Entity Manager view method for it after building the entity view using + * getViewBuilder method. + * $render_controller = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId()); + * return $render_controller->view($entity, $view_mode, $langcode); */ function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $reset = FALSE) { $render_controller = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId()); @@ -289,6 +326,12 @@ function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $res * @return array * A render array for the entities, indexed by the same keys as the * entities array passed in $entities. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * Entity Manager viewMultiple method for it after building the entity view + * using getViewBuilder method. + * $render_controller = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId()); + * return $render_controller->viewMultiple($entities, $view_mode, $langcode); */ function entity_view_multiple(array $entities, $view_mode, $langcode = NULL, $reset = FALSE) { $render_controller = \Drupal::entityManager()->getViewBuilder(reset($entities)->getEntityTypeId()); @@ -336,6 +379,9 @@ function entity_view_multiple(array $entities, $view_mode, $langcode = NULL, $re * * @return \Drupal\Core\Entity\Display\EntityViewDisplayInterface * The entity view display associated to the view mode. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * EntityManager load function to load entity specific view display. */ function entity_get_display($entity_type, $bundle, $view_mode) { // Try loading the display from configuration. @@ -392,6 +438,9 @@ function entity_get_display($entity_type, $bundle, $view_mode) { * * @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface * The entity form display associated to the given form mode. + * + * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use + * EntityManager load function to load its specific form display. */ function entity_get_form_display($entity_type, $bundle, $form_mode) { // Try loading the entity from configuration.