It's all in the title.
Issue fork domain-3573820
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
It's all in the title.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedComment #4
mably commentedConverted all Domain module procedural hooks to OOP format using
#[Hook]attributes, with#[LegacyHook]delegates in.modulefiles for Drupal 10.x backward compatibility.Hook classes created/updated
domain module:
DomainHooks— hook_help, hook_domain_references_alterDomainThemeHooks— hook_theme, preprocess_html, preprocessDomainNavBlock (viainitial preprocess)DomainEntityHooks— form_user_form_alter, views_data_alterDomainTokenHooks— token_info, tokensdomain_access module:
DomainAccessEntityHooks— entity presave/insert/delete/predelete, entity_prepare_form, entity_field_access, entity_bundle_field_info_alter, node_type_insert, entity_form_display_insertDomainAccessNodeHooks— node_grants, node_access_records, node_access, node_create_accessDomainAccessFormHooks— form_alter, form_node_form_alter, form_user_form_alter, form_devel_generate_form_content_alter, form_devel_generate_form_user_alter, form_field_config_edit_form_alterDomainAccessViewsHooks— views_data_alterDomainAccessDomainHooks— domain_references_alter, domain_insert, domain_deletedomain_source module:
DomainSourceEntityHooks— entity_update, node_presave, node_type_insert, entity_form_display_insert, domain_insert, domain_deleteDomainSourceFormHooks— form_alter, form_node_form_alter, form_devel_generate_form_content_alterDomainSourceTokenHooks— token_info, tokensDomainSourceViewsHooks— views_data_alterdomain_alias module:
DomainAliasHooks— domain_request_alter, domain_operations, domain_load, domain_deletedomain_config_ui module:
DomainConfigUiFormHooks— form_alterdomain_content module:
DomainContentHooks— domain_operationsTest modules:
domain_test— DomainTestHooks (5 hooks)domain_config_hook_test— DomainConfigHookTestHooks (2 hooks)domain_config_test— DomainConfigTestHooks (2 hooks)domain_config_ui_hook_test— DomainConfigUiHookTestHooks (1 hook)domain_source_test— DomainSourceTestHooks (1 hook)Helper services created
DomainAccessHelper/DomainAccessHelperInterface— extracteddomain_access_confirm_fields()logicDomainSourceHelper/DomainSourceHelperInterface— extracteddomain_source_confirm_fields(),domain_source_get(),domain_source_get_source_domain()logicDeprecated procedural functions
All deprecated functions are thin wrappers delegating to their OOP equivalents:
domain_uri()->Domain::uri()template_preprocess_domain_nav_block()->DomainThemeHooks::preprocessDomainNavBlock()domain_access_confirm_fields()->DomainAccessHelper::confirmFields()domain_source_confirm_fields()->DomainSourceHelper::confirmFields()domain_source_get()->DomainSourceHelper::getSourceDomainId()domain_source_get_source_domain()->DomainSourceHelper::getSourceDomain()_domain_source_create_domain_source_set_action()->DomainSourceEntityHooks::createDomainSourceSetAction()Other improvements
initial preprocesskey inhook_theme()for the domain nav block preprocess callbackuri_callbackto a static method on theDomainentity class$this->container->get()instead of\Drupal::service()All 133 tests pass (3560 assertions).
Comment #5
mably commentedBug fixes
var_dump($path)debug output.DomainSourceElementManagerInterface→DomainSourceHelperInterfacefordomain_source_get_source_domain().entityFormDisplayInsert()hook that checked$entity instanceof NodeInterfaceon anEntityFormDisplayentity (always false). Already covered bynodeTypeInsert().NodeInterfaceimport.Style / cleanup
ContainerInjectionInterfaceimplementation andcreate()factory method (class is already registered as an autowired service).staticvariables to instance properties ($aliasesCache,$patternCache). Removed deadurl.sitecache context check (always true sinceDomainServiceProvideradds it automatically). Removed$rendererConfigconstructor param and%renderer.config%service argument.static $active_domaincaching (negotiator already caches internally).DomainHooks→ fully qualified\Drupal\domain\Hook\DomainThemeHooks(also corrected the class name).Documentation
url.siteis now automatically added byDomainServiceProvider, no manualservices.ymlconfiguration needed. Added note for users upgrading from older versions.url.siteconfiguration step, noted it is now handled automatically.Comment #6
mably commentedBreaking change: The constructor of
DomainSourcePathProcessorhas a new required parameterDomainSourceHelperInterface $sourceHelper, inserted before the optional$languageNegotiatorparameter. Any module that decorates or extends this service with an explicit constructor call will need to be updated. The new parameter is autowired, so standard service definitions using autowiring are not affected.Comment #8
mably commentedComment #12
mably commentedConvert
hook_requirements()to OOP#[Hook('runtime_requirements')]for both domain and domain_content sub-modules.Changes
domain/domain.install
#[LegacyRequirementsHook]attribute ondomain_requirements()to suppress the deprecation on Drupal 11.3+ and prevent double execution.DomainHooks::runtimeRequirements(), guarded by a$phase === 'runtime'check to avoid calling the service before the module is installed.domain/src/Hook/DomainHooks.php
EntityTypeManagerInterfacedependency (autowired).runtimeRequirements()method with#[Hook('runtime_requirements')]— contains the duplicate domain ID detection logic previously in the procedural hook, now using$this->entityTypeManagerand$this->t()instead of static\Drupalcalls.domain_content/domain_content.install
#[LegacyRequirementsHook]attribute ondomain_content_requirements()with the same phase-guarded delegation pattern.domain_content/src/Hook/DomainContentHooks.php
ModuleHandlerInterfaceandConfigFactoryInterfacedependencies (autowired).runtimeRequirements()method with#[Hook('runtime_requirements')]— contains the Domain Access field validation logic, now using injected services instead of static\Drupalcalls.Backward compatibility
#[LegacyRequirementsHook]is ignored, the procedural function runs normally and delegates to the OOP method.#[LegacyRequirementsHook]prevents the procedural function from running, the OOP#[Hook('runtime_requirements')]is called directly by the hook system.