summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-05-17 09:28:36 (GMT)
committerNathaniel Catchpole2016-05-17 09:28:36 (GMT)
commit0d9fa5c03e4d2b3cf156cf9127a042f714b97d73 (patch)
tree4aa70ea16aa602fb32c8cbb1186811114c0dcdf1
parentcb310b69ad7ffab5d5d184acd70baa72fc49291b (diff)
Issue #2723571 by danielmrichards: Remove entity_load* usage for entity_form_display entity type
-rw-r--r--core/includes/entity.inc2
-rw-r--r--core/modules/field_ui/src/Tests/ManageDisplayTest.php4
-rw-r--r--core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php2
-rw-r--r--core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php4
-rw-r--r--core/modules/image/src/Entity/ImageStyle.php3
5 files changed, 9 insertions, 6 deletions
diff --git a/core/includes/entity.inc b/core/includes/entity.inc
index d48aa4e..69a07d7 100644
--- a/core/includes/entity.inc
+++ b/core/includes/entity.inc
@@ -538,7 +538,7 @@ function entity_get_display($entity_type, $bundle, $view_mode) {
*/
function entity_get_form_display($entity_type, $bundle, $form_mode) {
// Try loading the entity from configuration.
- $entity_form_display = entity_load('entity_form_display', $entity_type . '.' . $bundle . '.' . $form_mode);
+ $entity_form_display = EntityFormDisplay::load($entity_type . '.' . $bundle . '.' . $form_mode);
// If not found, create a fresh entity object. We do not preemptively create
// new entity form display configuration entries for each existing entity type
diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
index b135186..f023559 100644
--- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php
@@ -261,7 +261,9 @@ class ManageDisplayTest extends WebTestBase {
// Save the form to save the third party settings.
$this->drupalPostForm(NULL, array(), t('Save'));
\Drupal::entityManager()->clearCachedFieldDefinitions();
- $display = entity_load('entity_form_display', 'node.' . $this->type . '.default', TRUE);
+ $storage = $this->container->get('entity_type.manager')->getStorage('entity_form_display');
+ $storage->resetCache(array('node.' . $this->type . '.default'));
+ $display = $storage->load('node.' . $this->type . '.default');
$this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'), 'foo');
$this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()->getDependencies()['module']), 'Form display does not have a dependency on field_third_party_test module.');
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
index 67ad20f..711be26 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
@@ -314,7 +314,7 @@ class EntityDisplayTest extends KernelTestBase {
$type->delete();
$display = entity_load('entity_view_display', 'node.article.default');
$this->assertFalse((bool) $display);
- $form_display = entity_load('entity_form_display', 'node.article.default');
+ $form_display = EntityFormDisplay::load('node.article.default');
$this->assertFalse((bool) $form_display);
}
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
index b66d29c..e38db7c 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php
@@ -158,7 +158,7 @@ class EntityFormDisplayTest extends KernelTestBase {
$this->assertFalse(isset($data['hidden']['test_display_non_configurable']));
// Check that defaults are correctly filled when loading the display.
- $display = entity_load('entity_form_display', $display->id());
+ $display = EntityFormDisplay::load($display->id());
foreach ($expected as $field_name => $options) {
$this->assertEqual($display->getComponent($field_name), $options);
}
@@ -168,7 +168,7 @@ class EntityFormDisplayTest extends KernelTestBase {
$data['content']['test_display_non_configurable'] = $expected['test_display_non_configurable'];
$data['content']['test_display_non_configurable']['weight']++;
$config->setData($data)->save();
- $display = entity_load('entity_form_display', $display->id());
+ $display = EntityFormDisplay::load($display->id());
foreach ($expected as $field_name => $options) {
$this->assertEqual($display->getComponent($field_name), $options);
}
diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php
index 7314435..86035de 100644
--- a/core/modules/image/src/Entity/ImageStyle.php
+++ b/core/modules/image/src/Entity/ImageStyle.php
@@ -4,6 +4,7 @@ namespace Drupal\image\Entity;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\Entity\ConfigEntityBase;
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityWithPluginCollectionInterface;
use Drupal\Core\Routing\RequestHelper;
@@ -146,7 +147,7 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity
}
}
}
- foreach (entity_load_multiple('entity_form_display') as $display) {
+ foreach (EntityFormDisplay::loadMultiple() as $display) {
foreach ($display->getComponents() as $name => $options) {
if (isset($options['type']) && $options['type'] == 'image_image' && $options['settings']['preview_image_style'] == $style->getOriginalId()) {
$options['settings']['preview_image_style'] = $style->id();