mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/structural_pages.git
synced 2026-03-11 02:47: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:
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\Attribute;
|
||||
namespace Drupal\structural_pages\Attribute;
|
||||
|
||||
use Drupal\Component\Plugin\Attribute\Plugin;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
@@ -12,9 +12,9 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
*
|
||||
* Plugin namespace: Plugin\ParentEntityHandler.
|
||||
*
|
||||
* @see \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerInterface
|
||||
* @see \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerBase
|
||||
* @see \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManager
|
||||
* @see \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerInterface
|
||||
* @see \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerBase
|
||||
* @see \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManager
|
||||
* @see plugin_api
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
@@ -51,7 +51,7 @@ class ParentEntityHandler extends Plugin {
|
||||
* (optional) The deriver class.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $id,
|
||||
string $id,
|
||||
public readonly TranslatableMarkup $label,
|
||||
public readonly string $entity_type_id,
|
||||
public readonly ?string $provider_module = NULL,
|
||||
@@ -60,7 +60,7 @@ class ParentEntityHandler extends Plugin {
|
||||
public readonly ?string $route_parameter = NULL,
|
||||
public readonly array $bundle_restrictions = [],
|
||||
public readonly int $weight = 0,
|
||||
public readonly ?string $deriver = NULL,
|
||||
?string $deriver = NULL,
|
||||
) {
|
||||
parent::__construct($id, $deriver);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\Breadcrumb;
|
||||
namespace Drupal\structural_pages\Breadcrumb;
|
||||
|
||||
use Drupal\Core\Breadcrumb\Breadcrumb;
|
||||
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
|
||||
@@ -11,7 +11,7 @@ use Drupal\Core\Link;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface;
|
||||
use Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface;
|
||||
|
||||
/**
|
||||
* Provides a breadcrumb builder for section_page and content_page content types.
|
||||
@@ -30,7 +30,7 @@ class SectionBreadcrumbBuilder implements BreadcrumbBuilderInterface {
|
||||
/**
|
||||
* The parent entity handler manager.
|
||||
*
|
||||
* @var \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface
|
||||
* @var \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface
|
||||
*/
|
||||
protected ParentEntityHandlerManagerInterface $handlerManager;
|
||||
|
||||
@@ -46,7 +46,7 @@ class SectionBreadcrumbBuilder implements BreadcrumbBuilderInterface {
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
|
||||
* The entity type manager.
|
||||
* @param \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface $handler_manager
|
||||
* @param \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface $handler_manager
|
||||
* The parent entity handler manager.
|
||||
*/
|
||||
public function __construct(
|
||||
@@ -169,7 +169,7 @@ class SectionBreadcrumbBuilder implements BreadcrumbBuilderInterface {
|
||||
];
|
||||
}
|
||||
|
||||
// If parent is taxonomy_term, that's our context (handled via site_section).
|
||||
// If parent is taxonomy_term, that's our context (handled via site_sections).
|
||||
if ($parent_entity_type === 'taxonomy_term') {
|
||||
return [
|
||||
'type' => 'taxonomy_term',
|
||||
|
||||
@@ -2,20 +2,21 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\Form;
|
||||
namespace Drupal\structural_pages\Form;
|
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||
use Drupal\Core\Config\TypedConfigManagerInterface;
|
||||
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
use Drupal\Core\Form\ConfigFormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface;
|
||||
use Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Configuration form for Site Structure module.
|
||||
* Configuration form for Structural Pages module.
|
||||
*/
|
||||
class SiteStructureSettingsForm extends ConfigFormBase {
|
||||
class StructuralPagesSettingsForm extends ConfigFormBase {
|
||||
|
||||
/**
|
||||
* The entity type manager.
|
||||
@@ -34,29 +35,32 @@ class SiteStructureSettingsForm extends ConfigFormBase {
|
||||
/**
|
||||
* The parent entity handler manager.
|
||||
*
|
||||
* @var \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface
|
||||
* @var \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface
|
||||
*/
|
||||
protected ParentEntityHandlerManagerInterface $handlerManager;
|
||||
|
||||
/**
|
||||
* Constructs a SiteStructureSettingsForm object.
|
||||
* Constructs a StructuralPagesSettingsForm object.
|
||||
*
|
||||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
||||
* The factory for configuration objects.
|
||||
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager
|
||||
* The typed config manager.
|
||||
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
|
||||
* The entity type manager.
|
||||
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
|
||||
* The entity type bundle info service.
|
||||
* @param \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface $handler_manager
|
||||
* @param \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface $handler_manager
|
||||
* The parent entity handler manager.
|
||||
*/
|
||||
public function __construct(
|
||||
ConfigFactoryInterface $config_factory,
|
||||
TypedConfigManagerInterface $typed_config_manager,
|
||||
EntityTypeManagerInterface $entity_type_manager,
|
||||
EntityTypeBundleInfoInterface $entity_type_bundle_info,
|
||||
ParentEntityHandlerManagerInterface $handler_manager,
|
||||
) {
|
||||
parent::__construct($config_factory);
|
||||
parent::__construct($config_factory, $typed_config_manager);
|
||||
$this->entityTypeManager = $entity_type_manager;
|
||||
$this->entityTypeBundleInfo = $entity_type_bundle_info;
|
||||
$this->handlerManager = $handler_manager;
|
||||
@@ -68,6 +72,7 @@ class SiteStructureSettingsForm extends ConfigFormBase {
|
||||
public static function create(ContainerInterface $container): static {
|
||||
return new static(
|
||||
$container->get('config.factory'),
|
||||
$container->get('config.typed'),
|
||||
$container->get('entity_type.manager'),
|
||||
$container->get('entity_type.bundle.info'),
|
||||
$container->get('plugin.manager.parent_entity_handler'),
|
||||
@@ -78,21 +83,21 @@ class SiteStructureSettingsForm extends ConfigFormBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId(): string {
|
||||
return 'site_structure_settings_form';
|
||||
return 'structural_pages_settings_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getEditableConfigNames(): array {
|
||||
return ['site_structure.settings'];
|
||||
return ['structural_pages.settings'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state): array {
|
||||
$config = $this->config('site_structure.settings');
|
||||
$config = $this->config('structural_pages.settings');
|
||||
$allowed_targets = $config->get('allowed_parent_targets') ?? [];
|
||||
|
||||
// Build a keyed array for easier lookup.
|
||||
@@ -217,7 +222,7 @@ class SiteStructureSettingsForm extends ConfigFormBase {
|
||||
}
|
||||
}
|
||||
|
||||
$this->config('site_structure.settings')
|
||||
$this->config('structural_pages.settings')
|
||||
->set('allowed_parent_targets', $targets)
|
||||
->save();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\ParentEntityHandler;
|
||||
namespace Drupal\structural_pages\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\Breadcrumb\Breadcrumb;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\ParentEntityHandler;
|
||||
namespace Drupal\structural_pages\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\Breadcrumb\Breadcrumb;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\ParentEntityHandler;
|
||||
namespace Drupal\structural_pages\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\Breadcrumb\Breadcrumb;
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
@@ -11,14 +11,14 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\Core\Plugin\DefaultPluginManager;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\site_structure\Attribute\ParentEntityHandler;
|
||||
use Drupal\structural_pages\Attribute\ParentEntityHandler;
|
||||
|
||||
/**
|
||||
* Plugin manager for parent entity handlers.
|
||||
*
|
||||
* @see \Drupal\site_structure\Attribute\ParentEntityHandler
|
||||
* @see \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerInterface
|
||||
* @see \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerBase
|
||||
* @see \Drupal\structural_pages\Attribute\ParentEntityHandler
|
||||
* @see \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerInterface
|
||||
* @see \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerBase
|
||||
*/
|
||||
class ParentEntityHandlerManager extends DefaultPluginManager implements ParentEntityHandlerManagerInterface {
|
||||
|
||||
@@ -32,7 +32,7 @@ class ParentEntityHandlerManager extends DefaultPluginManager implements ParentE
|
||||
/**
|
||||
* Static cache for handler instances.
|
||||
*
|
||||
* @var \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerInterface[]|null
|
||||
* @var \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerInterface[]|null
|
||||
*/
|
||||
protected ?array $handlerInstances = NULL;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\ParentEntityHandler;
|
||||
namespace Drupal\structural_pages\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\Breadcrumb\Breadcrumb;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
@@ -22,7 +22,7 @@ interface ParentEntityHandlerManagerInterface {
|
||||
* Handlers are available if their provider module is installed and the
|
||||
* entity type exists.
|
||||
*
|
||||
* @return \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerInterface[]
|
||||
* @return \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerInterface[]
|
||||
* An array of available handler instances, keyed by plugin ID.
|
||||
*/
|
||||
public function getAvailableHandlers(): array;
|
||||
@@ -33,7 +33,7 @@ interface ParentEntityHandlerManagerInterface {
|
||||
* @param string $entity_type_id
|
||||
* The entity type ID.
|
||||
*
|
||||
* @return \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerInterface|null
|
||||
* @return \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerInterface|null
|
||||
* The handler for the entity type, or NULL if none found.
|
||||
*/
|
||||
public function getHandlerForEntityType(string $entity_type_id): ?ParentEntityHandlerInterface;
|
||||
@@ -44,7 +44,7 @@ interface ParentEntityHandlerManagerInterface {
|
||||
* @param \Drupal\Core\Entity\EntityInterface $entity
|
||||
* The entity.
|
||||
*
|
||||
* @return \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerInterface|null
|
||||
* @return \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerInterface|null
|
||||
* The handler for the entity, or NULL if none found.
|
||||
*/
|
||||
public function getHandlerForEntity(EntityInterface $entity): ?ParentEntityHandlerInterface;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\Plugin\Block;
|
||||
namespace Drupal\structural_pages\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
@@ -12,22 +12,22 @@ use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface;
|
||||
use Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a dynamic menu block based on site structure hierarchy.
|
||||
*
|
||||
* @Block(
|
||||
* id = "site_structure_menu",
|
||||
* admin_label = @Translation("Site Structure Menu"),
|
||||
* category = @Translation("Site Structure"),
|
||||
* id = "structural_pages_menu",
|
||||
* admin_label = @Translation("Structural Pages Menu"),
|
||||
* category = @Translation("Structural Pages"),
|
||||
* context_definitions = {
|
||||
* "node" = @ContextDefinition("entity:node", label = @Translation("Node"), required = FALSE),
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class SiteStructureMenuBlock extends BlockBase implements ContainerFactoryPluginInterface {
|
||||
class StructuralPagesMenuBlock extends BlockBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
/**
|
||||
* Maximum depth to prevent infinite loops.
|
||||
@@ -51,7 +51,7 @@ class SiteStructureMenuBlock extends BlockBase implements ContainerFactoryPlugin
|
||||
/**
|
||||
* The parent entity handler manager.
|
||||
*
|
||||
* @var \Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerManagerInterface
|
||||
* @var \Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerManagerInterface
|
||||
*/
|
||||
protected ParentEntityHandlerManagerInterface $handlerManager;
|
||||
|
||||
@@ -175,7 +175,7 @@ class SiteStructureMenuBlock extends BlockBase implements ContainerFactoryPlugin
|
||||
}
|
||||
|
||||
$build = [
|
||||
'#theme' => 'site_structure_menu',
|
||||
'#theme' => 'structural_pages_menu',
|
||||
'#ancestor' => $ancestor,
|
||||
'#tree' => $tree,
|
||||
'#active_trail' => $active_trail,
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\Plugin\ParentEntityHandler;
|
||||
namespace Drupal\structural_pages\Plugin\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\Breadcrumb\Breadcrumb;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\site_structure\Attribute\ParentEntityHandler;
|
||||
use Drupal\site_structure\ParentEntityHandler\ParentEntityHandlerBase;
|
||||
use Drupal\structural_pages\Attribute\ParentEntityHandler;
|
||||
use Drupal\structural_pages\ParentEntityHandler\ParentEntityHandlerBase;
|
||||
|
||||
/**
|
||||
* Handler for node entities.
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\Plugin\ParentEntityHandler;
|
||||
namespace Drupal\structural_pages\Plugin\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\Breadcrumb\Breadcrumb;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
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;
|
||||
use Drupal\taxonomy\TermInterface;
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ use Drupal\taxonomy\TermInterface;
|
||||
entity_type_id: 'taxonomy_term',
|
||||
clears_site_section: FALSE,
|
||||
sort_field: 'name',
|
||||
bundle_restrictions: ['site_section'],
|
||||
bundle_restrictions: ['site_sections'],
|
||||
weight: 0,
|
||||
)]
|
||||
class TaxonomyTermHandler extends ParentEntityHandlerBase {
|
||||
@@ -69,8 +69,8 @@ class TaxonomyTermHandler extends ParentEntityHandlerBase {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Only site_section terms can be site sections.
|
||||
if ($entity->bundle() !== 'site_section') {
|
||||
// Only site_sections terms can be site sections.
|
||||
if ($entity->bundle() !== 'site_sections') {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\site_structure\Plugin\ParentEntityHandler;
|
||||
namespace Drupal\structural_pages\Plugin\ParentEntityHandler;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
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;
|
||||
use Drupal\user\UserInterface;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user