Skip to content
Snippets Groups Projects
Commit 45abcb54 authored by Viktor Holovachek's avatar Viktor Holovachek
Browse files

Issue #3426550 - Fix validation

parent 0f565ba1
No related branches found
No related tags found
1 merge request!18Issue #3426550 - Fix validation
Pipeline #114365 passed with warnings
......@@ -33,7 +33,7 @@ function entity_body_class_help($route_name, RouteMatchInterface $route_match) {
function entity_body_class_entity_base_field_info(EntityTypeInterface $entity_type) {
$fields = [];
if (in_array('Drupal\Core\Entity\ContentEntityInterface', class_implements($entity_type->getOriginalClass())) &&
if (in_array(ContentEntityInterface::class, class_implements($entity_type->getOriginalClass())) &&
$entity_type->getLinkTemplate('canonical')
) {
$fields['entity_body_class'] = BaseFieldDefinition::create('string')
......
......@@ -3,6 +3,7 @@
namespace Drupal\entity_body_class;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -48,7 +49,7 @@ class EntityBodyClassPermissions implements ContainerInjectionInterface {
$permissions = [];
foreach ($this->entityTypeManager->getDefinitions() as $definition) {
if (in_array('Drupal\Core\Entity\ContentEntityInterface', class_implements($definition->getOriginalClass())) &&
if (in_array(ContentEntityInterface::class, class_implements($definition->getOriginalClass())) &&
$definition->getLinkTemplate('canonical')
) {
$permissions["access {$definition->id()} body class field"] = [
......
......@@ -3,6 +3,7 @@
namespace Drupal\entity_body_class\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
......@@ -73,7 +74,7 @@ class EntityBodyClassForm extends ConfigFormBase {
];
foreach ($this->entityTypeManager->getDefinitions() as $definition) {
if (in_array('Drupal\Core\Entity\ContentEntityInterface', class_implements($definition->getOriginalClass())) &&
if (in_array(ContentEntityInterface::class, class_implements($definition->getOriginalClass())) &&
$definition->getLinkTemplate('canonical')
) {
$id = $definition->id();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment