mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-03-09 10:07:40 -03:00
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>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user