comparison core/includes/entity.inc @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
65 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 65 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
66 * The method overriding Entity::load() for the entity type, e.g. 66 * The method overriding Entity::load() for the entity type, e.g.
67 * \Drupal\node\Entity\Node::load() if the entity type is known. If the 67 * \Drupal\node\Entity\Node::load() if the entity type is known. If the
68 * entity type is variable, use the entity manager service to load the entity 68 * entity type is variable, use the entity manager service to load the entity
69 * from the entity storage: 69 * from the entity storage:
70 * @code 70 * @code
71 * \Drupal::entityTypeManager()->getStorage($entity_type)->load($id); 71 * \Drupal::entityTypeManager()->getStorage($entity_type)->load($id);
72 * @endcode 72 * @endcode
73 * 73 *
74 * @see \Drupal\Core\Entity\EntityInterface::load() 74 * @see \Drupal\Core\Entity\EntityInterface::load()
75 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 75 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
76 * @see \Drupal\Core\Entity\EntityStorageInterface::load() 76 * @see \Drupal\Core\Entity\EntityStorageInterface::load()
77 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage 77 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage
98 * id. 98 * id.
99 * 99 *
100 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 100 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
101 * the entity storage's loadRevision() method to load a specific entity 101 * the entity storage's loadRevision() method to load a specific entity
102 * revision: 102 * revision:
103 * @code 103 * @code
104 * \Drupal::entityTypeManager() 104 * \Drupal::entityTypeManager()
105 * ->getStorage($entity_type) 105 * ->getStorage($entity_type)
106 * ->loadRevision($revision_id); 106 * ->loadRevision($revision_id);
107 * @endcode 107 * @endcode
108 * 108 *
109 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 109 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
110 * @see \Drupal\Core\Entity\EntityStorageInterface::loadRevision() 110 * @see \Drupal\Core\Entity\EntityStorageInterface::loadRevision()
111 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage 111 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage
112 */ 112 */
125 * The revision ID to delete. 125 * The revision ID to delete.
126 * 126 *
127 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 127 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
128 * the entity storage's deleteRevision() method to delete a specific entity 128 * the entity storage's deleteRevision() method to delete a specific entity
129 * revision: 129 * revision:
130 * @code 130 * @code
131 * \Drupal::entityTypeManager() 131 * \Drupal::entityTypeManager()
132 * ->getStorage($entity_type) 132 * ->getStorage($entity_type)
133 * ->deleteRevision($revision_id); 133 * ->deleteRevision($revision_id);
134 * @endcode 134 * @endcode
135 * 135 *
136 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 136 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
137 * @see \Drupal\Core\Entity\EntityStorageInterface::deleteRevision() 137 * @see \Drupal\Core\Entity\EntityStorageInterface::deleteRevision()
138 */ 138 */
139 function entity_revision_delete($entity_type, $revision_id) { 139 function entity_revision_delete($entity_type, $revision_id) {
173 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 173 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
174 * The method overriding Entity::loadMultiple() for the entity type, e.g. 174 * The method overriding Entity::loadMultiple() for the entity type, e.g.
175 * \Drupal\node\Entity\Node::loadMultiple() if the entity type is known. If 175 * \Drupal\node\Entity\Node::loadMultiple() if the entity type is known. If
176 * the entity type is variable, use the entity manager service to load the 176 * the entity type is variable, use the entity manager service to load the
177 * entity from the entity storage: 177 * entity from the entity storage:
178 * @code 178 * @code
179 * \Drupal::entityTypeManager()->getStorage($entity_type)->loadMultiple($id); 179 * \Drupal::entityTypeManager()->getStorage($entity_type)->loadMultiple($id);
180 * @endcode 180 * @endcode
181 * 181 *
182 * @see \Drupal\Core\Entity\EntityInterface::loadMultiple() 182 * @see \Drupal\Core\Entity\EntityInterface::loadMultiple()
183 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 183 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
184 * @see \Drupal\Core\Entity\EntityStorageInterface::loadMultiple() 184 * @see \Drupal\Core\Entity\EntityStorageInterface::loadMultiple()
185 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage 185 * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage
207 * no matching entities are found. 207 * no matching entities are found.
208 * 208 *
209 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 209 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
210 * the entity storage's loadByProperties() method to load an entity by their 210 * the entity storage's loadByProperties() method to load an entity by their
211 * property values: 211 * property values:
212 * @code 212 * @code
213 * \Drupal::entityTypeManager() 213 * \Drupal::entityTypeManager()
214 * ->getStorage($entity_type) 214 * ->getStorage($entity_type)
215 * ->loadByProperties($values); 215 * ->loadByProperties($values);
216 * @endcode 216 * @endcode
217 * 217 *
218 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 218 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
219 * @see \Drupal\Core\Entity\EntityStorageInterface::loadByProperties() 219 * @see \Drupal\Core\Entity\EntityStorageInterface::loadByProperties()
220 */ 220 */
221 function entity_load_multiple_by_properties($entity_type, array $values) { 221 function entity_load_multiple_by_properties($entity_type, array $values) {
240 * @return \Drupal\Core\Entity\EntityInterface|null 240 * @return \Drupal\Core\Entity\EntityInterface|null
241 * The unchanged entity, or FALSE if the entity cannot be loaded. 241 * The unchanged entity, or FALSE if the entity cannot be loaded.
242 * 242 *
243 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 243 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
244 * the entity storage's loadUnchanged() method to load an unchanged entity: 244 * the entity storage's loadUnchanged() method to load an unchanged entity:
245 * @code 245 * @code
246 * \Drupal::entityTypeManager()->getStorage($entity_type)->loadUnchanged($id); 246 * \Drupal::entityTypeManager()->getStorage($entity_type)->loadUnchanged($id);
247 * @endcode 247 * @endcode
248 * 248 *
249 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 249 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
250 * @see \Drupal\Core\Entity\EntityStorageInterface::loadUnchanged() 250 * @see \Drupal\Core\Entity\EntityStorageInterface::loadUnchanged()
251 */ 251 */
252 function entity_load_unchanged($entity_type, $id) { 252 function entity_load_unchanged($entity_type, $id) {
263 * @param array $ids 263 * @param array $ids
264 * An array of entity IDs of the entities to delete. 264 * An array of entity IDs of the entities to delete.
265 * 265 *
266 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 266 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
267 * the entity storage's delete() method to delete multiple entities: 267 * the entity storage's delete() method to delete multiple entities:
268 * @code 268 * @code
269 * $storage_handler = \Drupal::entityTypeManager()->getStorage($entity_type); 269 * $storage_handler = \Drupal::entityTypeManager()->getStorage($entity_type);
270 * $entities = $storage_handler->loadMultiple($ids); 270 * $entities = $storage_handler->loadMultiple($ids);
271 * $storage_handler->delete($entities); 271 * $storage_handler->delete($entities);
272 * @endcode 272 * @endcode
273 * 273 *
274 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 274 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
275 * @see \Drupal\Core\Entity\EntityStorageInterface::loadMultiple() 275 * @see \Drupal\Core\Entity\EntityStorageInterface::loadMultiple()
276 * @see \Drupal\Core\Entity\EntityStorageInterface::delete() 276 * @see \Drupal\Core\Entity\EntityStorageInterface::delete()
277 */ 277 */
296 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 296 * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
297 * The method overriding Entity::create() for the entity type, e.g. 297 * The method overriding Entity::create() for the entity type, e.g.
298 * \Drupal\node\Entity\Node::create() if the entity type is known. If the 298 * \Drupal\node\Entity\Node::create() if the entity type is known. If the
299 * entity type is variable, use the entity storage's create() method to 299 * entity type is variable, use the entity storage's create() method to
300 * construct a new entity: 300 * construct a new entity:
301 * @code 301 * @code
302 * \Drupal::entityTypeManager()->getStorage($entity_type)->create($values); 302 * \Drupal::entityTypeManager()->getStorage($entity_type)->create($values);
303 * @endcode 303 * @endcode
304 * 304 *
305 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() 305 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
306 * @see \Drupal\Core\Entity\EntityStorageInterface::create() 306 * @see \Drupal\Core\Entity\EntityStorageInterface::create()
307 */ 307 */
308 function entity_create($entity_type, array $values = []) { 308 function entity_create($entity_type, array $values = []) {
324 * @return string|null 324 * @return string|null
325 * The label of the entity, or NULL if there is no label defined. 325 * The label of the entity, or NULL if there is no label defined.
326 * 326 *
327 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use 327 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
328 * the entity's label() method to get the label of the entity: 328 * the entity's label() method to get the label of the entity:
329 * @code 329 * @code
330 * $entity->label($langcode); 330 * $entity->label($langcode);
331 * @endcode 331 * @endcode
332 * 332 *
333 * @see \Drupal\Core\Entity\EntityInterface::label() 333 * @see \Drupal\Core\Entity\EntityInterface::label()
334 */ 334 */
335 function entity_page_label(EntityInterface $entity, $langcode = NULL) { 335 function entity_page_label(EntityInterface $entity, $langcode = NULL) {
336 return $entity->label($langcode); 336 return $entity->label($langcode);
353 * @return array 353 * @return array
354 * A render array for the entity. 354 * A render array for the entity.
355 * 355 *
356 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. 356 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
357 * Use the entity view builder's view() method for creating a render array: 357 * Use the entity view builder's view() method for creating a render array:
358 * @code 358 * @code
359 * $view_builder = \Drupal::entityTypeManager() 359 * $view_builder = \Drupal::entityTypeManager()
360 * ->getViewBuilder($entity->getEntityTypeId()); 360 * ->getViewBuilder($entity->getEntityTypeId());
361 * return $view_builder->view($entity, $view_mode, $langcode); 361 * return $view_builder->view($entity, $view_mode, $langcode);
362 * @endcode 362 * @endcode
363 * 363 *
364 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder() 364 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder()
365 * @see \Drupal\Core\Entity\EntityViewBuilderInterface::view() 365 * @see \Drupal\Core\Entity\EntityViewBuilderInterface::view()
366 */ 366 */
367 function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $reset = FALSE) { 367 function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $reset = FALSE) {
391 * entities array passed in $entities. 391 * entities array passed in $entities.
392 * 392 *
393 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. 393 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
394 * Use the entity view builder's viewMultiple() method for creating a render 394 * Use the entity view builder's viewMultiple() method for creating a render
395 * array for the provided entities: 395 * array for the provided entities:
396 * @code 396 * @code
397 * $view_builder = \Drupal::entityTypeManager() 397 * $view_builder = \Drupal::entityTypeManager()
398 * ->getViewBuilder($entity->getEntityTypeId()); 398 * ->getViewBuilder($entity->getEntityTypeId());
399 * return $view_builder->viewMultiple($entities, $view_mode, $langcode); 399 * return $view_builder->viewMultiple($entities, $view_mode, $langcode);
400 * @endcode 400 * @endcode
401 * 401 *
402 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder() 402 * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder()
403 * @see \Drupal\Core\Entity\EntityViewBuilderInterface::viewMultiple() 403 * @see \Drupal\Core\Entity\EntityViewBuilderInterface::viewMultiple()
404 */ 404 */
405 function entity_view_multiple(array $entities, $view_mode, $langcode = NULL, $reset = FALSE) { 405 function entity_view_multiple(array $entities, $view_mode, $langcode = NULL, $reset = FALSE) {