sites_group_overrides-1.x-dev/src/Entity/LayoutBuilderEntityViewDisplay.php

src/Entity/LayoutBuilderEntityViewDisplay.php
<?php

declare(strict_types=1);

namespace Drupal\sites_group_overrides\Entity;

use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\group\Entity\GroupRelationshipInterface;
use Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay as LayoutBuilderEntityViewDisplayCore;

/**
 * Provides an entity view display for group_relationship layouts.
 */
class LayoutBuilderEntityViewDisplay extends LayoutBuilderEntityViewDisplayCore {

  /**
   * {@inheritdoc}
   */
  protected function buildSections(FieldableEntityInterface $entity) {
    // Since we render the entity on the layout, set it as a context.
    if ($entity instanceof GroupRelationshipInterface) {
      $entity = $entity->getEntity();
    }

    return parent::buildSections($entity);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc