Files
structural_pages/modules/structural_pages_group/src/Plugin/ParentEntityHandler/GroupHandler.php
Quintino A. G. Souza 88b9605408 Rename module site_structure → structural_pages and vocabulary site_section → site_sections
Renames the module from site_structure to structural_pages and pluralizes
the taxonomy vocabulary machine name from site_section to site_sections,
updating all config, PHP, translations, and documentation references
while preserving field_site_section, clears_site_section, and $site_section_id.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 08:10:32 -03:00

52 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace Drupal\structural_pages_group\Plugin\ParentEntityHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\group\Entity\GroupInterface;
use Drupal\structural_pages\Attribute\ParentEntityHandler;
use Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerBase;
/**
* Handler for group entities.
*
* This handler is provided by the structural_pages_group submodule and is only
* available when the Group module is installed.
*/
#[ParentEntityHandler(
id: 'group',
label: new TranslatableMarkup('Groups (group)'),
entity_type_id: 'group',
provider_module: 'group',
clears_site_section: TRUE,
sort_field: 'label',
weight: 15,
)]
class GroupHandler extends ParentEntityHandlerBase {
/**
* {@inheritdoc}
*/
public function getEntityFromRoute(RouteMatchInterface $route_match): ?EntityInterface {
$group = $route_match->getParameter('group');
if (!$group instanceof GroupInterface) {
return NULL;
}
return $group;
}
/**
* {@inheritdoc}
*/
public function handlesEntity(EntityInterface $entity): bool {
return $entity instanceof GroupInterface;
}
}