function it_registers_theme_schema_alias_if_not_exists_during_loading_settings(SettingsManagerInterface $decoratedSettingsManager, ServiceRegistryInterface $schemaRegistry, ThemeSettingsSchemaProviderInterface $themeSettingsSchemaProvider, ThemeInterface $theme, SettingsInterface $settings, SchemaInterface $schema) { $theme->getName()->willReturn('theme/name'); $schemaRegistry->has('theme_theme/name')->willReturn(false); $themeSettingsSchemaProvider->getSchema($theme)->willReturn($schema); $schemaRegistry->register('theme_theme/name', $schema)->shouldBeCalled(); $decoratedSettingsManager->load('theme_theme/name', null)->willReturn($settings); $this->load($theme)->shouldReturn($settings); }
/** * {@inheritdoc} */ public function load(ThemeInterface $theme, $namespace = null) { $schemaAlias = sprintf('theme_%s', $theme->getName()); if (!$this->schemaRegistry->has($schemaAlias)) { $schema = $this->themeSettingsSchemaProvider->getSchema($theme); $this->schemaRegistry->register($schemaAlias, $schema); } return $this->decoratedSettingsManager->load($schemaAlias, $namespace); }