mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-03-08 01:27:42 -03:00
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>
52 lines
1.2 KiB
PHP
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;
|
|
}
|
|
|
|
}
|