Add structural_pages_event submodule for Event entity support

Bridge submodule that registers Event entities (from event_management
module) as valid parent types for content_page nodes. Events act as
context containers (clears_site_section: TRUE), similar to users and
groups.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 07:32:59 -03:00
parent c1274bf3ce
commit eff3c0122f
4 changed files with 98 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,8 @@
name: 'Structural Pages Event Integration'
type: module
description: 'Provides Event entity support as parent type for Structural Pages module.'
package: 'Structural Pages'
core_version_requirement: ^10.3 || ^11
dependencies:
- structural_pages:structural_pages
- event_management:event_management

View File

@@ -0,0 +1,27 @@
# Portuguese (Brazil) translation for Structural Pages Event Integration.
# Copyright (C) 2024
# This file is distributed under the same license as the Drupal package.
#
msgid ""
msgstr ""
"Project-Id-Version: Structural Pages Event Integration 1.0.0\n"
"POT-Creation-Date: 2024-01-01 00:00+0000\n"
"PO-Revision-Date: 2024-01-01 00:00+0000\n"
"Language-Team: Portuguese, Brazil\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt-br\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: structural_pages_event.info.yml
msgid "Structural Pages Event Integration"
msgstr "Integração de Eventos das Páginas Estruturais"
#: structural_pages_event.info.yml
msgid "Provides Event entity support as parent type for Structural Pages module."
msgstr "Fornece suporte a entidades Evento como tipo pai para o módulo Páginas Estruturais."
#: src/Plugin/ParentEntityHandler/EventHandler.php
msgid "Events (event)"
msgstr "Eventos (event)"

View File

@@ -264,3 +264,15 @@ msgstr "Integração de Grupos das Páginas Estruturais"
#: modules/structural_pages_group/structural_pages_group.info.yml
msgid "Provides Group entity support as parent type for Structural Pages module."
msgstr "Fornece suporte a entidades Grupo como tipo pai para o módulo Páginas Estruturais."
#: modules/structural_pages_event/src/Plugin/ParentEntityHandler/EventHandler.php
msgid "Events (event)"
msgstr "Eventos (event)"
#: modules/structural_pages_event/structural_pages_event.info.yml
msgid "Structural Pages Event Integration"
msgstr "Integração de Eventos das Páginas Estruturais"
#: modules/structural_pages_event/structural_pages_event.info.yml
msgid "Provides Event entity support as parent type for Structural Pages module."
msgstr "Fornece suporte a entidades Evento como tipo pai para o módulo Páginas Estruturais."