Commit 0d9fa5c0 authored by catch's avatar catch

Issue #2723571 by danielmrichards: Remove entity_load* usage for entity_form_display entity type

parent cb310b69
......@@ -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
......
......@@ -261,7 +261,9 @@ public function testWidgetUI() {
// 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.');
......
......@@ -314,7 +314,7 @@ public function testDeleteBundle() {
$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);
}
......
......@@ -158,7 +158,7 @@ public function testBaseFieldComponent() {
$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 @@ public function testBaseFieldComponent() {
$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);
}
......
......@@ -4,6 +4,7 @@
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 @@ protected static function replaceImageStyle(ImageStyleInterface $style) {
}
}
}
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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment