Skip to content
Snippets Groups Projects
Commit 083351db authored by Adam G-H's avatar Adam G-H
Browse files

Merge branch '8.x-1.x' into 3433700-automated-drupal-11

parents 507d6fbf c6efd655
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,14 @@ include: ...@@ -33,6 +33,14 @@ include:
# View these include files at https://git.drupalcode.org/project/gitlab_templates/ # View these include files at https://git.drupalcode.org/project/gitlab_templates/
################ ################
- project: $_GITLAB_TEMPLATES_REPO - project: $_GITLAB_TEMPLATES_REPO
<<<<<<< HEAD
=======
# "ref" value can be:
# - Recommended (default) - `ref: $_GITLAB_TEMPLATES_REF` - The Drupal Association will update this value to the recommended tag for contrib.
# - Latest - `ref: main` - Get the latest additions and bug fixes as they are merged into the templates.
# - Minor or Major latests - `ref: 1.x-latest` or `ref: 1.0.x-latest` - Get the latest additions within a minor (mostly bugfixes) or major (bugs and new features).
# - Fixed tag - `ref: 1.0.1` - Set the value to a known tag. This will not get any updates.
>>>>>>> 8.x-1.x
ref: $_GITLAB_TEMPLATES_REF ref: $_GITLAB_TEMPLATES_REF
file: file:
- '/includes/include.drupalci.main.yml' - '/includes/include.drupalci.main.yml'
...@@ -49,15 +57,12 @@ include: ...@@ -49,15 +57,12 @@ include:
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml # Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################ ################
variables: variables:
# SKIP_ESLINT: '1'
# Broaden test coverage. # Broaden test coverage.
OPT_IN_TEST_PREVIOUS_MAJOR: 1
OPT_IN_TEST_PREVIOUS_MINOR: 1 OPT_IN_TEST_PREVIOUS_MINOR: 1
OPT_IN_TEST_NEXT_MINOR: 1 OPT_IN_TEST_NEXT_MINOR: 1
OPT_IN_TEST_NEXT_MAJOR: 1 OPT_IN_TEST_NEXT_MAJOR: 1
OPT_IN_TEST_MAX_PHP: 1 OPT_IN_TEST_MAX_PHP: 1
################################################################################### ###################################################################################
# #
# * # *
......
name: OpenAPI UI name: OpenAPI UI
type: module type: module
description: Provides plugin system for OpenAPI/Swagger Interface libraries. description: Provides plugin system for OpenAPI/Swagger Interface libraries.
core_version_requirement: ^9 || ^10 || ^11 core_version_requirement: ^10 || ^11
package: OpenAPI package: OpenAPI
...@@ -2,12 +2,16 @@ ...@@ -2,12 +2,16 @@
namespace Drupal\openapi_ui\Element; namespace Drupal\openapi_ui\Element;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Component\Utility\DeprecationHelper;
use Drupal\Core\Render\Element\ElementInterface;
use Drupal\Core\Render\Element\RenderElement; use Drupal\Core\Render\Element\RenderElement;
use Drupal\Core\Render\Element\RenderElementBase;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\openapi_ui\Plugin\openapi_ui\OpenApiUiInterface; use Drupal\openapi_ui\Plugin\openapi_ui\OpenApiUiInterface;
/** /**
* Defines a render element for OpenApi Doc display library. * Defines a render element for OpenApi Doc display libraries.
* *
* This display element will act as a wrapper for the ui element. The rendering * This display element will act as a wrapper for the ui element. The rendering
* process will use the library's plugin in order to allow for the plugin to * process will use the library's plugin in order to allow for the plugin to
...@@ -28,7 +32,7 @@ use Drupal\openapi_ui\Plugin\openapi_ui\OpenApiUiInterface; ...@@ -28,7 +32,7 @@ use Drupal\openapi_ui\Plugin\openapi_ui\OpenApiUiInterface;
* - A callback function: The docs can be implemented via a callback. The * - A callback function: The docs can be implemented via a callback. The
* callback will be passed the render element and as a result should take * callback will be passed the render element and as a result should take
* exactly one parameter, an array, and return either an array with openapi * exactly one parameter, an array, and return either an array with openapi
* compliant schema or an url for the schema. * compliant schema or a url for the schema.
* *
* Doc library plugins may only support specific formats for the openapi docs. * Doc library plugins may only support specific formats for the openapi docs.
* They may also support additional properties on this render element which can * They may also support additional properties on this render element which can
...@@ -52,19 +56,15 @@ use Drupal\openapi_ui\Plugin\openapi_ui\OpenApiUiInterface; ...@@ -52,19 +56,15 @@ use Drupal\openapi_ui\Plugin\openapi_ui\OpenApiUiInterface;
* *
* @RenderElement("openapi_ui") * @RenderElement("openapi_ui")
*/ */
class OpenApiUi extends RenderElement { class OpenApiUi extends PluginBase implements ElementInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getInfo() { public function getInfo() {
$class = get_class($this);
return [ return [
'#pre_render' => [ '#pre_render' => [
[ [static::class, 'preRenderOpenApiUi'],
$class,
'preRenderOpenApiUi',
],
], ],
]; ];
} }
...@@ -118,4 +118,19 @@ class OpenApiUi extends RenderElement { ...@@ -118,4 +118,19 @@ class OpenApiUi extends RenderElement {
return $element; return $element;
} }
/**
* {@inheritdoc}
*/
public static function setAttributes(&$element, $class = []) {
// This method can be removed when Drupal 10.3 is the minimum supported
// version of core, and this class extends RenderElementBase instead of
// implementing ElementInterface.
DeprecationHelper::backwardsCompatibleCall(
\Drupal::VERSION,
'10.3.0',
fn () => RenderElementBase::setAttributes($element, $class),
fn () => RenderElement::setAttributes($element, $class),
);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment