mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-03-10 02:17:42 -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:
@@ -1,8 +1,8 @@
|
||||
# Site Structure - Design Document
|
||||
# Structural Pages - Design Document
|
||||
|
||||
## Overview
|
||||
|
||||
The `site_structure` module implements a hierarchical editorial structure and contextual navigation for institutional sites in Drupal 11. The module was designed for higher education institutions but is generic enough for other institutional contexts.
|
||||
The `structural_pages` module implements a hierarchical editorial structure and contextual navigation for institutional sites in Drupal 11. The module was designed for higher education institutions but is generic enough for other institutional contexts.
|
||||
|
||||
## Problem
|
||||
|
||||
@@ -21,7 +21,7 @@ The module implements two complementary structures:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────┐
|
||||
│ PRIMARY STRUCTURE: site_section Taxonomy │
|
||||
│ PRIMARY STRUCTURE: site_sections Taxonomy │
|
||||
│ │
|
||||
│ - Governs the overall organization of site information │
|
||||
│ - Defines breadcrumbs and URLs (via Pathauto) │
|
||||
@@ -48,12 +48,12 @@ The module implements two complementary structures:
|
||||
|
||||
## Components
|
||||
|
||||
### 1. Taxonomy Vocabulary: `site_section`
|
||||
### 1. Taxonomy Vocabulary: `site_sections`
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
| Machine name | `site_section` |
|
||||
| Name | Site Section |
|
||||
| Machine name | `site_sections` |
|
||||
| Name | Site Sections |
|
||||
| Hierarchical | Yes |
|
||||
| Description | Main hierarchical structure for site organization |
|
||||
|
||||
@@ -104,7 +104,7 @@ The `field_parent_page` uses the Dynamic Entity Reference module to support mult
|
||||
**Default allowed targets**:
|
||||
- `node:content_page` - Other content pages
|
||||
- `node:section_page` - Section pages
|
||||
- `taxonomy_term:site_section` - Site section terms
|
||||
- `taxonomy_term:site_sections` - Site section terms
|
||||
- `user:user` - User accounts
|
||||
- `group:*` - All group types (requires Group module)
|
||||
|
||||
@@ -113,7 +113,7 @@ The `field_parent_page` uses the Dynamic Entity Reference module to support mult
|
||||
- **User**: Content pages are associated with the user profile page (`/user/{id}`). The `field_site_section` is cleared as the context is the user itself.
|
||||
- **Group**: Content pages are associated with the group. The `field_site_section` is cleared as the context is the group itself.
|
||||
|
||||
**Configuration**: `/admin/config/local-modules/site-structure`
|
||||
**Configuration**: `/admin/config/local-modules/structural-pages`
|
||||
|
||||
### 5. Inheritance Logic
|
||||
|
||||
@@ -124,7 +124,7 @@ When a content_page is saved:
|
||||
IF field_parent_page is filled:
|
||||
IF parent is user or group:
|
||||
Clear field_site_section (context is the entity itself)
|
||||
ELSE IF parent is taxonomy_term (site_section):
|
||||
ELSE IF parent is taxonomy_term (site_sections):
|
||||
Set field_site_section to the parent term ID
|
||||
ELSE IF parent is node with field_site_section:
|
||||
Copy field_site_section from parent node
|
||||
@@ -181,12 +181,12 @@ View that lists child pages of the current `content_page`.
|
||||
|
||||
### 9. Settings Form
|
||||
|
||||
Configuration form at `/admin/config/local-modules/site-structure` that allows administrators to:
|
||||
Configuration form at `/admin/config/local-modules/structural-pages` that allows administrators to:
|
||||
- Select which node bundles can be used as parents
|
||||
- Select which taxonomy vocabularies can be used as parents
|
||||
- Changes automatically update the field configuration
|
||||
|
||||
### 10. Block: Site Structure Menu
|
||||
### 10. Block: Structural Pages Menu
|
||||
|
||||
Dynamic menu block that renders hierarchical navigation based on the content structure.
|
||||
|
||||
@@ -221,7 +221,7 @@ Documentation (ancestor: taxonomy term)
|
||||
|
||||
**Usage**:
|
||||
1. Navigate to Structure > Block layout
|
||||
2. Place "Site Structure Menu" block in desired region
|
||||
2. Place "Structural Pages Menu" block in desired region
|
||||
3. Configure visibility (e.g., show only on content_page nodes)
|
||||
4. Adjust depth and display options as needed
|
||||
|
||||
@@ -230,19 +230,19 @@ Documentation (ancestor: taxonomy term)
|
||||
## File Structure
|
||||
|
||||
```
|
||||
site_structure/
|
||||
├── site_structure.info.yml # Metadata and dependencies
|
||||
├── site_structure.module # Hooks (presave, tokens, theme)
|
||||
├── site_structure.install # Installation hooks
|
||||
├── site_structure.services.yml # Service registration
|
||||
├── site_structure.routing.yml # Route definitions
|
||||
├── site_structure.links.menu.yml # Admin menu links
|
||||
├── site_structure.libraries.yml # Asset libraries (CSS)
|
||||
structural_pages/
|
||||
├── structural_pages.info.yml # Metadata and dependencies
|
||||
├── structural_pages.module # Hooks (presave, tokens, theme)
|
||||
├── structural_pages.install # Installation hooks
|
||||
├── structural_pages.services.yml # Service registration
|
||||
├── structural_pages.routing.yml # Route definitions
|
||||
├── structural_pages.links.menu.yml # Admin menu links
|
||||
├── structural_pages.libraries.yml # Asset libraries (CSS)
|
||||
│
|
||||
├── config/
|
||||
│ ├── install/
|
||||
│ │ ├── site_structure.settings.yml # Default settings
|
||||
│ │ ├── taxonomy.vocabulary.site_section.yml
|
||||
│ │ ├── structural_pages.settings.yml # Default settings
|
||||
│ │ ├── taxonomy.vocabulary.site_sections.yml
|
||||
│ │ │
|
||||
│ │ ├── node.type.section_page.yml
|
||||
│ │ ├── field.storage.node.field_site_section.yml
|
||||
@@ -259,18 +259,18 @@ site_structure/
|
||||
│ │ │
|
||||
│ │ ├── pathauto.pattern.section_page.yml
|
||||
│ │ ├── pathauto.pattern.content_page.yml
|
||||
│ │ ├── pathauto.pattern.site_section_term.yml
|
||||
│ │ ├── pathauto.pattern.site_sections_term.yml
|
||||
│ │ │
|
||||
│ │ └── views.view.child_pages.yml
|
||||
│ │
|
||||
│ └── schema/
|
||||
│ └── site_structure.schema.yml # Config schema
|
||||
│ └── structural_pages.schema.yml # Config schema
|
||||
│
|
||||
├── css/
|
||||
│ └── site-structure-menu.css # Menu block styles
|
||||
│ └── structural-pages-menu.css # Menu block styles
|
||||
│
|
||||
├── templates/
|
||||
│ └── site-structure-menu.html.twig # Menu block template
|
||||
│ └── structural-pages-menu.html.twig # Menu block template
|
||||
│
|
||||
├── translations/
|
||||
│ └── pt-br.po # Portuguese (Brazil) translation
|
||||
@@ -289,11 +289,11 @@ site_structure/
|
||||
│ │ └── SectionBreadcrumbBuilder.php
|
||||
│ │
|
||||
│ ├── Form/
|
||||
│ │ └── SiteStructureSettingsForm.php
|
||||
│ │ └── StructuralPagesSettingsForm.php
|
||||
│ │
|
||||
│ └── Plugin/
|
||||
│ ├── Block/
|
||||
│ │ └── SiteStructureMenuBlock.php # Dynamic menu block
|
||||
│ │ └── StructuralPagesMenuBlock.php # Dynamic menu block
|
||||
│ │
|
||||
│ └── ParentEntityHandler/ # Built-in handlers
|
||||
│ ├── TaxonomyTermHandler.php # taxonomy_term handler
|
||||
@@ -301,8 +301,8 @@ site_structure/
|
||||
│ └── NodeHandler.php # node handler
|
||||
│
|
||||
├── modules/
|
||||
│ └── site_structure_group/ # Group integration submodule
|
||||
│ ├── site_structure_group.info.yml
|
||||
│ └── structural_pages_group/ # Group integration submodule
|
||||
│ ├── structural_pages_group.info.yml
|
||||
│ └── src/Plugin/ParentEntityHandler/
|
||||
│ └── GroupHandler.php # group handler
|
||||
│
|
||||
@@ -346,7 +346,7 @@ site_structure/
|
||||
|
||||
1. **Create root page (anchored to taxonomy term)**:
|
||||
- Add content > Content Page
|
||||
- In "Parent Page", select a site_section term
|
||||
- In "Parent Page", select a site_sections term
|
||||
- Site section is set automatically from the term
|
||||
- Save
|
||||
|
||||
@@ -370,7 +370,7 @@ site_structure/
|
||||
|
||||
### Configuring Allowed Parent Types
|
||||
|
||||
1. Navigate to `/admin/config/local-modules/site-structure`
|
||||
1. Navigate to `/admin/config/local-modules/structural-pages`
|
||||
2. Select which content types (nodes) can be used as parents
|
||||
3. Select which taxonomy vocabularies can be used as parents
|
||||
4. Save configuration
|
||||
@@ -386,7 +386,7 @@ The module uses a plugin system to support different entity types as parents for
|
||||
|
||||
The plugin system consists of:
|
||||
|
||||
1. **Attribute**: `Drupal\site_structure\Attribute\ParentEntityHandler` - PHP 8 attribute for defining handlers
|
||||
1. **Attribute**: `Drupal\structural_pages\Attribute\ParentEntityHandler` - PHP 8 attribute for defining handlers
|
||||
2. **Interface**: `ParentEntityHandlerInterface` - Contract for all handlers
|
||||
3. **Base class**: `ParentEntityHandlerBase` - Common implementation
|
||||
4. **Manager**: `ParentEntityHandlerManager` - Plugin discovery and aggregation
|
||||
@@ -395,7 +395,7 @@ The plugin system consists of:
|
||||
|
||||
| Handler | Entity Type | Clears Site Section | Sort Field | Bundle Restrictions |
|
||||
|---------|-------------|---------------------|------------|---------------------|
|
||||
| TaxonomyTermHandler | taxonomy_term | No | name | site_section |
|
||||
| TaxonomyTermHandler | taxonomy_term | No | name | site_sections |
|
||||
| UserHandler | user | Yes | name | - |
|
||||
| NodeHandler | node | No | title | content_page, section_page |
|
||||
|
||||
@@ -409,8 +409,8 @@ To add support for a new entity type, create a handler plugin:
|
||||
namespace Drupal\my_module\Plugin\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
use Drupal\site_structure\Attribute\ParentEntityHandler;
|
||||
use Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerBase;
|
||||
use Drupal\structural_pages\Attribute\ParentEntityHandler;
|
||||
use Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerBase;
|
||||
|
||||
#[ParentEntityHandler(
|
||||
id: 'my_entity',
|
||||
@@ -442,7 +442,7 @@ class MyEntityHandler extends ParentEntityHandlerBase {
|
||||
|
||||
## Group Integration
|
||||
|
||||
Group support is provided via the `site_structure_group` submodule, which adds a handler for group entities. This submodule requires the Group module.
|
||||
Group support is provided via the `structural_pages_group` submodule, which adds a handler for group entities. This submodule requires the Group module.
|
||||
|
||||
**Features**:
|
||||
- Content pages can have groups as parent entities
|
||||
@@ -451,15 +451,15 @@ Group support is provided via the `site_structure_group` submodule, which adds a
|
||||
- `field_site_section` is cleared for group-parented content (context is the group)
|
||||
- Per-section permissions can be implemented via Groups
|
||||
|
||||
**Installation**: Enable the `site_structure_group` submodule after installing the Group module.
|
||||
**Installation**: Enable the `structural_pages_group` submodule after installing the Group module.
|
||||
|
||||
**Configuration**: Enable group types in the settings form at `/admin/config/local-modules/site-structure`
|
||||
**Configuration**: Enable group types in the settings form at `/admin/config/local-modules/structural-pages`
|
||||
|
||||
---
|
||||
|
||||
## Installation Verification
|
||||
|
||||
1. `drush en site_structure -y`
|
||||
1. `drush en structural_pages -y`
|
||||
2. Verify vocabulary at `/admin/structure/taxonomy`
|
||||
3. Verify content types at `/admin/structure/types`
|
||||
4. Create test hierarchical terms
|
||||
@@ -467,7 +467,7 @@ Group support is provided via the `site_structure_group` submodule, which adds a
|
||||
6. Create root `content_page` with taxonomy term as parent
|
||||
7. Create child `content_page`, verify inheritance
|
||||
8. Verify child pages View
|
||||
9. Test settings form at `/admin/config/local-modules/site-structure`
|
||||
9. Test settings form at `/admin/config/local-modules/structural-pages`
|
||||
|
||||
---
|
||||
|
||||
@@ -478,5 +478,5 @@ Group support is provided via the `site_structure_group` submodule, which adds a
|
||||
| 1.0.0 | - | Initial version |
|
||||
| 1.1.0 | - | Added dynamic_entity_reference support for multi-type parents |
|
||||
| 1.2.0 | - | Added user and group entity support as parent types |
|
||||
| 1.3.0 | - | Added Site Structure Menu block for dynamic hierarchical navigation |
|
||||
| 1.3.0 | - | Added Structural Pages Menu block for dynamic hierarchical navigation |
|
||||
| 2.0.0 | - | Refactored to plugin system for parent entity handlers. Group support moved to submodule. |
|
||||
|
||||
Reference in New Issue
Block a user