diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php index a4624b4..e436c8b 100644 --- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php @@ -2,6 +2,7 @@ namespace Drupal\rest\Plugin\rest\resource; +use Drupal\Core\Config\Entity\ConfigEntityType; use Drupal\Core\Entity\EntityTypeManager; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Entity\EntityInterface; @@ -331,10 +332,7 @@ public function availableMethods() { */ protected function isConfigEntityResource() { $entity_type_id = $this->getPluginDefinition()['entity_type']; - $entity_type = $this->entityTypeManager->getDefinition($entity_type_id); - $class = $entity_type->getClass(); - $interfaces = class_implements($class); - return in_array('Drupal\Core\Config\Entity\ConfigEntityInterface', $interfaces); + return $this->entityTypeManager->getDefinition($entity_type_id) instanceof ConfigEntityType; } } diff --git a/core/modules/rest/src/Tests/RESTTestBase.php b/core/modules/rest/src/Tests/RESTTestBase.php index 61dceec..4afbf94 100644 --- a/core/modules/rest/src/Tests/RESTTestBase.php +++ b/core/modules/rest/src/Tests/RESTTestBase.php @@ -2,6 +2,7 @@ namespace Drupal\rest\Tests; +use Drupal\Core\Config\Entity\ConfigEntityType; use Drupal\node\NodeInterface; use Drupal\simpletest\WebTestBase; @@ -377,10 +378,7 @@ protected function entityPermissions($entity_type_id, $operation) { default: return ['administer users']; - } - case 'field_storage_config': - return ['administer node fields']; default: if ($this->isConfigEntity($entity_type_id)) { @@ -464,10 +462,7 @@ protected function assertResponseBody($expected, $message = '', $group = 'REST R * TRUE if the entity is a Config Entity, FALSE otherwise. */ protected function isConfigEntity($entity_type_id) { - $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id); - $class = $entity_type->getClass(); - $interfaces = class_implements($class); - return in_array('Drupal\Core\Config\Entity\ConfigEntityInterface', $interfaces); + return \Drupal::entityTypeManager()->getDefinition($entity_type_id) instanceof ConfigEntityType; } /** @@ -498,14 +493,6 @@ protected function configEntityValues($entity_type_id) { case 'block': $values['plugin'] = 'system_powered_by_block'; break; - - case 'field_storage_config': - $values += [ - 'field_name' => strtolower($this->randomMachineName()), - 'type' => 'boolean', - 'entity_type' => 'node', - ]; - break; } return $values; } diff --git a/core/modules/rest/src/Tests/ReadTest.php b/core/modules/rest/src/Tests/ReadTest.php index 78f0eec..fb455d2 100644 --- a/core/modules/rest/src/Tests/ReadTest.php +++ b/core/modules/rest/src/Tests/ReadTest.php @@ -26,8 +26,6 @@ class ReadTest extends RESTTestBase { 'config_test', 'taxonomy', 'block', - 'field', - 'field_ui', ]; /** @@ -42,7 +40,6 @@ public function testRead() { 'config_test', 'taxonomy_vocabulary', 'block', - 'field_storage_config', 'user_role', ]; foreach ($entity_types as $entity_type) {