entity.inc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <?php
  2. /**
  3. * @file
  4. * Entity API for handling entities like nodes or users.
  5. */
  6. use Drupal\Core\Entity\EntityInterface;
  7. use Drupal\Core\Entity\Entity\EntityFormDisplay;
  8. use Drupal\Core\Entity\Entity\EntityViewDisplay;
  9. /**
  10. * Clears the entity render cache for all entity types.
  11. */
  12. function entity_render_cache_clear() {
  13. $entity_manager = Drupal::entityManager();
  14. foreach ($entity_manager->getDefinitions() as $entity_type => $info) {
  15. if ($entity_manager->hasHandler($entity_type, 'view_builder')) {
  16. $entity_manager->getViewBuilder($entity_type)->resetCache();
  17. }
  18. }
  19. }
  20. /**
  21. * Returns the entity bundle info.
  22. *
  23. * @param string|null $entity_type
  24. * The entity type whose bundle info should be returned, or NULL for all
  25. * bundles info. Defaults to NULL.
  26. *
  27. * @return array
  28. * The bundle info for a specific entity type, or all entity types.
  29. *
  30. * @deprecated in Drupal 8.x-dev and will be removed before Drupal 9.0.0. Use
  31. * \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getBundleInfo() for a
  32. * single bundle, or
  33. * \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getAllBundleInfo() for
  34. * all bundles.
  35. *
  36. * @see \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getBundleInfo()
  37. * @see \Drupal\Core\Entity\EntityTypeBundleInfoInterface::getAllBundleInfo()
  38. */
  39. function entity_get_bundles($entity_type = NULL) {
  40. if (isset($entity_type)) {
  41. return \Drupal::entityManager()->getBundleInfo($entity_type);
  42. }
  43. else {
  44. return \Drupal::entityManager()->getAllBundleInfo();
  45. }
  46. }
  47. /**
  48. * Loads an entity from the database.
  49. *
  50. * @param string $entity_type
  51. * The entity type to load, e.g. node or user.
  52. * @param mixed $id
  53. * The id of the entity to load.
  54. * @param bool $reset
  55. * Whether to reset the internal cache for the requested entity type.
  56. *
  57. * @return \Drupal\Core\Entity\EntityInterface|null
  58. * The entity object, or NULL if there is no entity with the given ID.
  59. *
  60. * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  61. * The method overriding Entity::load() for the entity type, e.g.
  62. * \Drupal\node\Entity\Node::load() if the entity type is known. If the
  63. * entity type is variable, use the entity manager service to load the entity
  64. * from the entity storage:
  65. * @code
  66. * \Drupal::entityTypeManager()->getStorage($entity_type)->load($id);
  67. * @endcode
  68. *
  69. * @see \Drupal\Core\Entity\EntityInterface::load()
  70. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  71. * @see \Drupal\Core\Entity\EntityStorageInterface::load()
  72. * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage
  73. * @see \Drupal\Core\Entity\Query\QueryInterface
  74. */
  75. function entity_load($entity_type, $id, $reset = FALSE) {
  76. $controller = \Drupal::entityManager()->getStorage($entity_type);
  77. if ($reset) {
  78. $controller->resetCache([$id]);
  79. }
  80. return $controller->load($id);
  81. }
  82. /**
  83. * Loads an entity from the database.
  84. *
  85. * @param string $entity_type
  86. * The entity type to load, e.g. node or user.
  87. * @param int $revision_id
  88. * The id of the entity to load.
  89. *
  90. * @return \Drupal\Core\Entity\EntityInterface|null
  91. * The entity object, or NULL if there is no entity with the given revision
  92. * id.
  93. *
  94. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  95. * the entity storage's loadRevision() method to load a specific entity
  96. * revision:
  97. * @code
  98. * \Drupal::entityTypeManager()
  99. * ->getStorage($entity_type)
  100. * ->loadRevision($revision_id);
  101. * @endcode
  102. *
  103. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  104. * @see \Drupal\Core\Entity\EntityStorageInterface::loadRevision()
  105. * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage
  106. */
  107. function entity_revision_load($entity_type, $revision_id) {
  108. return \Drupal::entityManager()
  109. ->getStorage($entity_type)
  110. ->loadRevision($revision_id);
  111. }
  112. /**
  113. * Deletes an entity revision.
  114. *
  115. * @param string $entity_type
  116. * The entity type to load, e.g. node or user.
  117. * @param $revision_id
  118. * The revision ID to delete.
  119. *
  120. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  121. * the entity storage's deleteRevision() method to delete a specific entity
  122. * revision:
  123. * @code
  124. * \Drupal::entityTypeManager()
  125. * ->getStorage($entity_type)
  126. * ->deleteRevision($revision_id);
  127. * @endcode
  128. *
  129. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  130. * @see \Drupal\Core\Entity\EntityStorageInterface::deleteRevision()
  131. */
  132. function entity_revision_delete($entity_type, $revision_id) {
  133. \Drupal::entityManager()
  134. ->getStorage($entity_type)
  135. ->deleteRevision($revision_id);
  136. }
  137. /**
  138. * Loads multiple entities from the database.
  139. *
  140. * This function should be used whenever you need to load more than one entity
  141. * from the database. The entities are loaded into memory and will not require
  142. * database access if loaded again during the same page request.
  143. *
  144. * The actual loading is done through a class that has to implement the
  145. * \Drupal\Core\Entity\EntityStorageInterface interface. By default,
  146. * \Drupal\Core\Entity\Sql\SqlContentEntityStorage is used for content entities
  147. * and Drupal\Core\Config\Entity\ConfigEntityStorage for config entities. Entity
  148. * types can specify that a different class should be used by setting the
  149. * "handlers['storage']" key in the entity plugin annotation. These classes
  150. * can either implement the \Drupal\Core\Entity\EntityStorageInterface
  151. * interface, or, most commonly, extend the
  152. * \Drupal\Core\Entity\Sql\SqlContentEntityStorage class. See
  153. * \Drupal\node\Entity\Node and \Drupal\node\NodeStorage for an example.
  154. *
  155. * @param string $entity_type
  156. * The entity type to load, e.g. node or user.
  157. * @param array $ids
  158. * (optional) An array of entity IDs. If omitted, all entities are loaded.
  159. * @param bool $reset
  160. * Whether to reset the internal cache for the requested entity type.
  161. *
  162. * @return array
  163. * An array of entity objects indexed by their IDs.
  164. *
  165. * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  166. * The method overriding Entity::loadMultiple() for the entity type, e.g.
  167. * \Drupal\node\Entity\Node::loadMultiple() if the entity type is known. If
  168. * the entity type is variable, use the entity manager service to load the
  169. * entity from the entity storage:
  170. * @code
  171. * \Drupal::entityTypeManager()->getStorage($entity_type)->loadMultiple($id);
  172. * @endcode
  173. *
  174. * @see \Drupal\Core\Entity\EntityInterface::loadMultiple()
  175. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  176. * @see \Drupal\Core\Entity\EntityStorageInterface::loadMultiple()
  177. * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage
  178. * @see \Drupal\Core\Entity\Query\QueryInterface
  179. */
  180. function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) {
  181. $controller = \Drupal::entityManager()->getStorage($entity_type);
  182. if ($reset) {
  183. $controller->resetCache($ids);
  184. }
  185. return $controller->loadMultiple($ids);
  186. }
  187. /**
  188. * Load entities by their property values.
  189. *
  190. * @param string $entity_type
  191. * The entity type to load, e.g. node or user.
  192. * @param array $values
  193. * An associative array where the keys are the property names and the
  194. * values are the values those properties must have.
  195. *
  196. * @return array
  197. * An array of entity objects indexed by their IDs. Returns an empty array if
  198. * no matching entities are found.
  199. *
  200. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  201. * the entity storage's loadByProperties() method to load an entity by their
  202. * property values:
  203. * @code
  204. * \Drupal::entityTypeManager()
  205. * ->getStorage($entity_type)
  206. * ->loadByProperties($values);
  207. * @endcode
  208. *
  209. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  210. * @see \Drupal\Core\Entity\EntityStorageInterface::loadByProperties()
  211. */
  212. function entity_load_multiple_by_properties($entity_type, array $values) {
  213. return \Drupal::entityManager()
  214. ->getStorage($entity_type)
  215. ->loadByProperties($values);
  216. }
  217. /**
  218. * Loads the unchanged, i.e. not modified, entity from the database.
  219. *
  220. * Unlike entity_load() this function ensures the entity is directly loaded from
  221. * the database, thus bypassing any static cache. In particular, this function
  222. * is useful to determine changes by comparing the entity being saved to the
  223. * stored entity.
  224. *
  225. * @param $entity_type
  226. * The entity type to load, e.g. node or user.
  227. * @param $id
  228. * The ID of the entity to load.
  229. *
  230. * @return \Drupal\Core\Entity\EntityInterface|null
  231. * The unchanged entity, or FALSE if the entity cannot be loaded.
  232. *
  233. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  234. * the entity storage's loadUnchanged() method to load an unchanged entity:
  235. * @code
  236. * \Drupal::entityTypeManager()->getStorage($entity_type)->loadUnchanged($id);
  237. * @endcode
  238. *
  239. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  240. * @see \Drupal\Core\Entity\EntityStorageInterface::loadUnchanged()
  241. */
  242. function entity_load_unchanged($entity_type, $id) {
  243. return \Drupal::entityManager()
  244. ->getStorage($entity_type)
  245. ->loadUnchanged($id);
  246. }
  247. /**
  248. * Deletes multiple entities permanently.
  249. *
  250. * @param string $entity_type
  251. * The type of the entity.
  252. * @param array $ids
  253. * An array of entity IDs of the entities to delete.
  254. *
  255. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  256. * the entity storage's delete() method to delete multiple entities:
  257. * @code
  258. * $storage_handler = \Drupal::entityTypeManager()->getStorage($entity_type);
  259. * $entities = $storage_handler->loadMultiple($ids);
  260. * $storage_handler->delete($entities);
  261. * @endcode
  262. *
  263. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  264. * @see \Drupal\Core\Entity\EntityStorageInterface::loadMultiple()
  265. * @see \Drupal\Core\Entity\EntityStorageInterface::delete()
  266. */
  267. function entity_delete_multiple($entity_type, array $ids) {
  268. $controller = \Drupal::entityManager()->getStorage($entity_type);
  269. $entities = $controller->loadMultiple($ids);
  270. $controller->delete($entities);
  271. }
  272. /**
  273. * Constructs a new entity object, without permanently saving it.
  274. *
  275. * @param string $entity_type
  276. * The type of the entity.
  277. * @param array $values
  278. * (optional) An array of values to set, keyed by property name. If the
  279. * entity type has bundles, the bundle key has to be specified.
  280. *
  281. * @return \Drupal\Core\Entity\EntityInterface
  282. * A new entity object.
  283. *
  284. * @deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  285. * The method overriding Entity::create() for the entity type, e.g.
  286. * \Drupal\node\Entity\Node::create() if the entity type is known. If the
  287. * entity type is variable, use the entity storage's create() method to
  288. * construct a new entity:
  289. * @code
  290. * \Drupal::entityTypeManager()->getStorage($entity_type)->create($values);
  291. * @endcode
  292. *
  293. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
  294. * @see \Drupal\Core\Entity\EntityStorageInterface::create()
  295. */
  296. function entity_create($entity_type, array $values = []) {
  297. return \Drupal::entityManager()
  298. ->getStorage($entity_type)
  299. ->create($values);
  300. }
  301. /**
  302. * Returns the label of an entity.
  303. *
  304. * @param \Drupal\Core\Entity\EntityInterface $entity
  305. * The entity for which to generate the label.
  306. * @param $langcode
  307. * (optional) The language code of the language that should be used for
  308. * getting the label. If set to NULL, the entity's default language is
  309. * used.
  310. *
  311. * @return string|null
  312. * The label of the entity, or NULL if there is no label defined.
  313. *
  314. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0. Use
  315. * the entity's label() method to get the label of the entity:
  316. * @code
  317. * $entity->label($langcode);
  318. * @endcode
  319. *
  320. * @see \Drupal\Core\Entity\EntityInterface::label()
  321. */
  322. function entity_page_label(EntityInterface $entity, $langcode = NULL) {
  323. return $entity->label($langcode);
  324. }
  325. /**
  326. * Returns the render array for an entity.
  327. *
  328. * @param \Drupal\Core\Entity\EntityInterface $entity
  329. * The entity to be rendered.
  330. * @param string $view_mode
  331. * The view mode that should be used to display the entity.
  332. * @param string $langcode
  333. * (optional) For which language the entity should be rendered, defaults to
  334. * the current content language.
  335. * @param bool $reset
  336. * (optional) Whether to reset the render cache for the requested entity.
  337. * Defaults to FALSE.
  338. *
  339. * @return array
  340. * A render array for the entity.
  341. *
  342. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
  343. * Use the entity view builder's view() method for creating a render array:
  344. * @code
  345. * $view_builder = \Drupal::entityTypeManager()
  346. * ->getViewBuilder($entity->getEntityTypeId());
  347. * return $view_builder->view($entity, $view_mode, $langcode);
  348. * @endcode
  349. *
  350. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder()
  351. * @see \Drupal\Core\Entity\EntityViewBuilderInterface::view()
  352. */
  353. function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $reset = FALSE) {
  354. $render_controller = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId());
  355. if ($reset) {
  356. $render_controller->resetCache([$entity]);
  357. }
  358. return $render_controller->view($entity, $view_mode, $langcode);
  359. }
  360. /**
  361. * Returns the render array for the provided entities.
  362. *
  363. * @param \Drupal\Core\Entity\EntityInterface[] $entities
  364. * The entities to be rendered, must be of the same type.
  365. * @param string $view_mode
  366. * The view mode that should be used to display the entity.
  367. * @param string $langcode
  368. * (optional) For which language the entity should be rendered, defaults to
  369. * the current content language.
  370. * @param bool $reset
  371. * (optional) Whether to reset the render cache for the requested entities.
  372. * Defaults to FALSE.
  373. *
  374. * @return array
  375. * A render array for the entities, indexed by the same keys as the
  376. * entities array passed in $entities.
  377. *
  378. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
  379. * Use the entity view builder's viewMultiple() method for creating a render
  380. * array for the provided entities:
  381. * @code
  382. * $view_builder = \Drupal::entityTypeManager()
  383. * ->getViewBuilder($entity->getEntityTypeId());
  384. * return $view_builder->viewMultiple($entities, $view_mode, $langcode);
  385. * @endcode
  386. *
  387. * @see \Drupal\Core\Entity\EntityTypeManagerInterface::getViewBuilder()
  388. * @see \Drupal\Core\Entity\EntityViewBuilderInterface::viewMultiple()
  389. */
  390. function entity_view_multiple(array $entities, $view_mode, $langcode = NULL, $reset = FALSE) {
  391. $render_controller = \Drupal::entityManager()->getViewBuilder(reset($entities)->getEntityTypeId());
  392. if ($reset) {
  393. $render_controller->resetCache($entities);
  394. }
  395. return $render_controller->viewMultiple($entities, $view_mode, $langcode);
  396. }
  397. /**
  398. * Returns the entity view display associated with a bundle and view mode.
  399. *
  400. * Use this function when assigning suggested display options for a component
  401. * in a given view mode. Note that they will only be actually used at render
  402. * time if the view mode itself is configured to use dedicated display settings
  403. * for the bundle; if not, the 'default' display is used instead.
  404. *
  405. * The function reads the entity view display from the current configuration, or
  406. * returns a ready-to-use empty one if configuration entry exists yet for this
  407. * bundle and view mode. This streamlines manipulation of display objects by
  408. * always returning a consistent object that reflects the current state of the
  409. * configuration.
  410. *
  411. * Example usage:
  412. * - Set the 'body' field to be displayed and the 'field_image' field to be
  413. * hidden on article nodes in the 'default' display.
  414. * @code
  415. * entity_get_display('node', 'article', 'default')
  416. * ->setComponent('body', array(
  417. * 'type' => 'text_summary_or_trimmed',
  418. * 'settings' => array('trim_length' => '200')
  419. * 'weight' => 1,
  420. * ))
  421. * ->removeComponent('field_image')
  422. * ->save();
  423. * @endcode
  424. *
  425. * @param string $entity_type
  426. * The entity type.
  427. * @param string $bundle
  428. * The bundle.
  429. * @param string $view_mode
  430. * The view mode, or 'default' to retrieve the 'default' display object for
  431. * this bundle.
  432. *
  433. * @return \Drupal\Core\Entity\Display\EntityViewDisplayInterface
  434. * The entity view display associated with the view mode.
  435. *
  436. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
  437. * If the display is available in configuration use:
  438. * @code
  439. * \Drupal::entityTypeManager()
  440. * ->getStorage('entity_view_display')
  441. * ->load($entity_type . '.' . $bundle . '.' . $view_mode);
  442. * @endcode
  443. * When the display is not available in configuration, you can create a new
  444. * EntityViewDisplay object using:
  445. * @code
  446. * $values = array(
  447. * 'targetEntityType' => $entity_type,
  448. * 'bundle' => $bundle,
  449. * 'mode' => $view_mode,
  450. * 'status' => TRUE,
  451. * );
  452. * \Drupal::entityTypeManager()
  453. * ->getStorage('entity_view_display')
  454. * ->create($values);
  455. * @endcode
  456. *
  457. * @see \Drupal\Core\Entity\EntityStorageInterface::create()
  458. * @see \Drupal\Core\Entity\EntityStorageInterface::load()
  459. */
  460. function entity_get_display($entity_type, $bundle, $view_mode) {
  461. // Try loading the display from configuration.
  462. $display = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $view_mode);
  463. // If not found, create a fresh display object. We do not preemptively create
  464. // new entity_view_display configuration entries for each existing entity type
  465. // and bundle whenever a new view mode becomes available. Instead,
  466. // configuration entries are only created when a display object is explicitly
  467. // configured and saved.
  468. if (!$display) {
  469. $display = EntityViewDisplay::create([
  470. 'targetEntityType' => $entity_type,
  471. 'bundle' => $bundle,
  472. 'mode' => $view_mode,
  473. 'status' => TRUE,
  474. ]);
  475. }
  476. return $display;
  477. }
  478. /**
  479. * Returns the entity form display associated with a bundle and form mode.
  480. *
  481. * The function reads the entity form display object from the current
  482. * configuration, or returns a ready-to-use empty one if no configuration entry
  483. * exists yet for this bundle and form mode. This streamlines manipulation of
  484. * entity form displays by always returning a consistent object that reflects
  485. * the current state of the configuration.
  486. *
  487. * Example usage:
  488. * - Set the 'body' field to be displayed with the 'text_textarea_with_summary'
  489. * widget and the 'field_image' field to be hidden on article nodes in the
  490. * 'default' form mode.
  491. * @code
  492. * entity_get_form_display('node', 'article', 'default')
  493. * ->setComponent('body', array(
  494. * 'type' => 'text_textarea_with_summary',
  495. * 'weight' => 1,
  496. * ))
  497. * ->setComponent('field_image', array(
  498. * 'region' => 'hidden',
  499. * ))
  500. * ->save();
  501. * @endcode
  502. *
  503. * @param string $entity_type
  504. * The entity type.
  505. * @param string $bundle
  506. * The bundle.
  507. * @param string $form_mode
  508. * The form mode.
  509. *
  510. * @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface
  511. * The entity form display associated with the given form mode.
  512. *
  513. * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
  514. * If the entity form display is available in configuration use:
  515. * @code
  516. * \Drupal::entityTypeManager()
  517. * ->getStorage('entity_form_display')
  518. * ->load($entity_type . '.' . $bundle . '.' . $form_mode);
  519. * @endcode
  520. * When the entity form display is not available in configuration, you can
  521. * create a new EntityFormDisplay object using:
  522. * @code
  523. * $values = array(
  524. * 'targetEntityType' => $entity_type,
  525. * 'bundle' => $bundle,
  526. * 'mode' => $form_mode,
  527. * 'status' => TRUE,
  528. * );
  529. * \Drupal::entityTypeManager()
  530. * ->getStorage('entity_form_display')
  531. * ->create($values);
  532. * @endcode
  533. *
  534. * @see \Drupal\Core\Entity\EntityStorageInterface::create()
  535. * @see \Drupal\Core\Entity\EntityStorageInterface::load()
  536. */
  537. function entity_get_form_display($entity_type, $bundle, $form_mode) {
  538. // Try loading the entity from configuration.
  539. $entity_form_display = EntityFormDisplay::load($entity_type . '.' . $bundle . '.' . $form_mode);
  540. // If not found, create a fresh entity object. We do not preemptively create
  541. // new entity form display configuration entries for each existing entity type
  542. // and bundle whenever a new form mode becomes available. Instead,
  543. // configuration entries are only created when an entity form display is
  544. // explicitly configured and saved.
  545. if (!$entity_form_display) {
  546. $entity_form_display = EntityFormDisplay::create([
  547. 'targetEntityType' => $entity_type,
  548. 'bundle' => $bundle,
  549. 'mode' => $form_mode,
  550. 'status' => TRUE,
  551. ]);
  552. }
  553. return $entity_form_display;
  554. }