diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..e5384a8cf9d2743a1ddee2df1f7ed5d3631399a1 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +################ +# GitLabCI template for Drupal projects. +# +# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. +# It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained. +# As long as you include the project, ref and three files below, any future updates added by the Drupal Association will be used in your +# pipelines automatically. However, you can modify this template if you have additional needs for your project. +# The full documentation is on https://project.pages.drupalcode.org/gitlab_templates/ +################ + +# For information on alternative values for 'ref' see https://project.pages.drupalcode.org/gitlab_templates/info/templates-version/ +# To test a Drupal 7 project, change the first include filename from .main.yml to .main-d7.yml +include: + - project: $_GITLAB_TEMPLATES_REPO + ref: $_GITLAB_TEMPLATES_REF + file: + - "/includes/include.drupalci.main.yml" + - "/includes/include.drupalci.variables.yml" + - "/includes/include.drupalci.workflows.yml" + +################ +# Pipeline configuration variables are defined with default values and descriptions in the file +# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml +# Uncomment the lines below if you want to override any of the variables. The following is just an example. +################ +# variables: +# SKIP_ESLINT: '1' +# OPT_IN_TEST_NEXT_MAJOR: '1' +# _CURL_TEMPLATES_REF: 'main' diff --git a/components_extras.info.yml b/components_extras.info.yml index 5fe96df92bb039ff0792159ca10a2196a2c25321..1d9c8c8f729c82e72bb5aec695ab13b4b4cfdb48 100644 --- a/components_extras.info.yml +++ b/components_extras.info.yml @@ -1,7 +1,7 @@ name: 'Components Extras' type: module description: 'Provide components plugin and an associated render element for developers' -core_version_requirement: ^8 || ^9 || ^10 +core_version_requirement: ^8 || ^9 || ^10 || ^11 package: 'Other' dependencies: - components diff --git a/components_extras.module b/components_extras.module index 8e3778ec8235d89df769de001251d9bef81dbb20..a9d0a11c2a556463dad740129bc7ae13dbbcfb00 100644 --- a/components_extras.module +++ b/components_extras.module @@ -10,7 +10,7 @@ use Drupal\Core\Routing\RouteMatchInterface; /** * Implements hook_help(). */ -function components_extras_help($route_name, RouteMatchInterface $route_match) { +function components_extras_help(string $route_name, RouteMatchInterface $route_match): string { switch ($route_name) { // Main module help for the components_extras module. case 'help.page.components_extras': @@ -20,13 +20,14 @@ function components_extras_help($route_name, RouteMatchInterface $route_match) { return $output; default: + return ''; } } /** * Implements hook_theme(). */ -function components_extras_theme() { +function components_extras_theme(): array { return [ 'components_extras' => [ 'render element' => 'element', diff --git a/src/ComponentThemeManager.php b/src/ComponentThemeManager.php index c6161bc5c55b6bae26edeaf829d62fc5a101ef93..d48331915e45c28614f0f3daa34a0bb8ec2cea8d 100644 --- a/src/ComponentThemeManager.php +++ b/src/ComponentThemeManager.php @@ -26,7 +26,10 @@ class ComponentThemeManager extends DefaultPluginManager implements ComponentThe 'label' => '', ]; - protected $themeHandler; + /** + * Theme handler service. + */ + protected ThemeHandlerInterface $themeHandler; /** * Constructs a new ComponentThemeManager object. @@ -43,13 +46,14 @@ class ComponentThemeManager extends DefaultPluginManager implements ComponentThe $this->moduleHandler = $module_handler; $this->themeHandler = $theme_handler; $this->setCacheBackend($cache_backend, 'component_theme', ['component_theme']); + $this->alterInfo('component_theme'); } /** * {@inheritdoc} */ protected function getDiscovery() { - if (!isset($this->discovery)) { + if (empty($this->discovery)) { $this->discovery = new YamlDiscovery('components', $this->moduleHandler->getModuleDirectories() + $this->themeHandler->getThemeDirectories()); $this->discovery->addTranslatableProperty('label', 'label_context'); $this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery); diff --git a/src/ComponentThemeManagerInterface.php b/src/ComponentThemeManagerInterface.php index 3fa7282203eae811f6705794b48bc64f781bf059..349c7acc3cdd48aeb0fdc9da78f6ce6e8b5ed00c 100644 --- a/src/ComponentThemeManagerInterface.php +++ b/src/ComponentThemeManagerInterface.php @@ -8,7 +8,4 @@ use Drupal\Component\Plugin\PluginManagerInterface; * Defines an interface for component_theme managers. */ interface ComponentThemeManagerInterface extends PluginManagerInterface { - - // Add getters and other public methods for component_theme managers. - } diff --git a/src/Element/ComponentTheme.php b/src/Element/ComponentTheme.php index fa4e85bb669863849bba4661c12b718fd661757f..940930d6aea6e627d5ee4ebee5272c690b8df7c6 100644 --- a/src/Element/ComponentTheme.php +++ b/src/Element/ComponentTheme.php @@ -2,15 +2,15 @@ namespace Drupal\components_extras\Element; -use Drupal\Core\Render\Element\RenderElement; +use Drupal\Core\Render\Element\RenderElementBase; /** - * Class ComponentTheme. + * Provides ComponentTheme class definition. * * @package Drupal\components_extras\Element * @RenderElement("component") */ -class ComponentTheme extends RenderElement { +class ComponentTheme extends RenderElementBase { /** * {@inheritdoc}