diff --git a/src/Config/ConfigUibOverride.php b/src/Config/ConfigUibOverride.php index dcf909a22232c2a18ac5671ede712ff700fce292..1691174aee11d66372d8d03fad099ec74b68d1a9 100644 --- a/src/Config/ConfigUibOverride.php +++ b/src/Config/ConfigUibOverride.php @@ -4,19 +4,42 @@ namespace Drupal\uib_common_ui\Config; use Drupal\Core\Config\ConfigFactoryOverrideInterface; use Drupal\Core\Config\StorageInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; /** * Provides configuration overrides for the uib_common_ui module. */ class ConfigUibOverride implements ConfigFactoryOverrideInterface { + /** + * The module handler service. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + + /** + * Constructs a ConfigUibOverride object. + * + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler service. + */ + public function __construct(ModuleHandlerInterface $module_handler) { + $this->moduleHandler = $module_handler; + } + /** * {@inheritDoc} */ public function loadOverrides($names): array { if (in_array('gin_login.settings', $names, TRUE)) { - $overrides['gin_login.settings']['logo'] = ['path' => 'modules/custom/uib_common_ui/public/image/uib_login_logo.svg']; + // Get the absolute path to the module and append the relative logo path. + $module_path = $this->moduleHandler->getModule('uib_common_ui')->getPath(); + $logo_path = $module_path . '/public/image/uib_login_logo.svg'; + + $overrides['gin_login.settings']['logo'] = ['path' => $logo_path]; } + return $overrides ?? []; } diff --git a/uib_common_ui.services.yml b/uib_common_ui.services.yml index e2a7a6e65facc612bdae92f26c69e93e1cf44f45..f599c40bcc47cf13635567f632fbb967d7c3cb9b 100644 --- a/uib_common_ui.services.yml +++ b/uib_common_ui.services.yml @@ -1,5 +1,6 @@ services: uib_common_ui.overrider: class: Drupal\uib_common_ui\Config\ConfigUibOverride + arguments: ['@module_handler'] tags: - {name: config.factory.override, priority: 5}