Commit 2f280556 authored by soltz's avatar soltz
Browse files

only allow TitleResolver to check for alternative field on fieldable entities. Fixes #3253835

parent d929a158
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Component\Utility\Xss;
@@ -61,7 +62,7 @@ class TitleResolver extends ControllerTitleResolver {
    }
    if ($entity !== NULL) {
      $alternative_title_field = $this->config->get(EasyBreadcrumbConstants::ALTERNATIVE_TITLE_FIELD);
      if ($entity->hasField($alternative_title_field) && !$entity->get($alternative_title_field)
      if ($entity instanceof FieldableEntityInterface && $entity->hasField($alternative_title_field) && !$entity->get($alternative_title_field)
        ->isEmpty()) {
        return Xss::filter($entity->get($alternative_title_field)->value);
      }