Commit 049224c8 authored by catch's avatar catch
Browse files

Issue #2641562 by Mac_Weber, legovaer: Replace deprecated usage of ...

Issue #2641562 by Mac_Weber, legovaer: Replace deprecated usage of  entity_create('entity_view_display') with a direct call to  EntityViewDisplay::create()
parent a173d727
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Entity\EntityFormDisplay; use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
/** /**
* Clears the entity render cache for all entity types. * Clears the entity render cache for all entity types.
...@@ -470,7 +471,7 @@ function entity_get_display($entity_type, $bundle, $view_mode) { ...@@ -470,7 +471,7 @@ function entity_get_display($entity_type, $bundle, $view_mode) {
// configuration entries are only created when a display object is explicitly // configuration entries are only created when a display object is explicitly
// configured and saved. // configured and saved.
if (!$display) { if (!$display) {
$display = entity_create('entity_view_display', array( $display = EntityViewDisplay::create(array(
'targetEntityType' => $entity_type, 'targetEntityType' => $entity_type,
'bundle' => $bundle, 'bundle' => $bundle,
'mode' => $view_mode, 'mode' => $view_mode,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
use Drupal\Core\Database\Database; use Drupal\Core\Database\Database;
use Drupal\simpletest\KernelTestBase; use Drupal\simpletest\KernelTestBase;
use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
/** /**
* Tests KernelTestBase functionality. * Tests KernelTestBase functionality.
...@@ -273,7 +274,7 @@ function testEnableModulesFixedList() { ...@@ -273,7 +274,7 @@ function testEnableModulesFixedList() {
$this->enableModules(array('field_test')); $this->enableModules(array('field_test'));
// Create a field. // Create a field.
entity_create('entity_view_display', array( $display = EntityViewDisplay::create(array(
'targetEntityType' => 'entity_test', 'targetEntityType' => 'entity_test',
'bundle' => 'entity_test', 'bundle' => 'entity_test',
'mode' => 'default', 'mode' => 'default',
......
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