Skip to content
Snippets Groups Projects
Commit 0d8d4d5c authored by Florent Torregrosa's avatar Florent Torregrosa
Browse files

Issue #3417476 by Grimreaper: Enable Gitlab CI + Update README + Coding standards

parent 445dadba
No related branches found
No related tags found
1 merge request!14Issue #3417476 by Grimreaper: Enable Gitlab CI + Update README + Coding standards
Pipeline #85920 passed
# https://git.drupalcode.org/project/gitlab_templates/
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'
# UI Examples
## Introduction
This module allows developers to provide example pages from modules or themes by
defining render arrays in a YAML files.
......@@ -18,10 +16,10 @@ album:
```
Where:
* `album` is the plugin ID. The page path is built from the plugin ID.
* `label` is used in the library.
* `description` is used in the library.
* `render` is the render array to render on the example page.
- `album` is the plugin ID. The page path is built from the plugin ID.
- `label` is used in the library.
- `description` is used in the library.
- `render` is the render array to render on the example page.
You can disable a plugin by declaring a plugin with the same ID and if your
module has a higher weight than the module declaring the plugin, example:
......@@ -33,31 +31,29 @@ album:
See the test modules for a complete example.
## Recommended Modules
[UI Suite Bootstrap](https://github.com/pdureau/ui_suite_bootstrap) is an
example of a site-building friendly Drupal theme using
[UI Examples](https://www.drupal.org/project/ui_examples) with
[UI Patterns](https://www.drupal.org/project/ui_patterns),
[Layout Options](https://www.drupal.org/project/layout_options) and
[UI Styles](https://www.drupal.org/project/ui_styles) modules, to implements
[Bootstrap](https://getbootstrap.com/) 4:
## Requirements
This module requires no modules outside of Drupal core.
![Overview](doc/schema.png)
## Installation
Install and enable this module like any other Drupal module.
Install as you would normally install a contributed Drupal module. For further
information, see
[Installing Drupal Modules](https://www.drupal.org/docs/extending-drupal/installing-drupal-modules).
## Configuration
The module has no modifiable settings.
The module has no modifiable settings. There is no configuration.
## Maintainers
Current maintainers:
* [Pierre Dureau (pdureau)](https://www.drupal.org/user/1903334)
* [Florent Torregrosa (Grimreaper)](https://www.drupal.org/user/2388214)
- Florent Torregrosa - [Grimreaper](https://www.drupal.org/user/2388214)
- Pierre Dureau - [pdureau](https://www.drupal.org/user/1903334)
This project has been sponsored by:
* [Smile](https://https://www.smile.eu)
Supporting organizations:
- [Smile](https://www.drupal.org/smile)
doc/schema.png

58.9 KiB

name: 'UI Examples Defaults'
type: module
description: 'Provide some defaults examples for standard Drupal elements.'
core_version_requirement: ^8.8 || ^9 || ^10
core_version_requirement: ^10
package: 'User interface'
dependencies:
- ui_examples:ui_examples
parameters:
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
excludePaths:
- */bower_components/*
- */node_modules/*
# Ignore some type hint errors due to hooks that should not have typed hint
# parameters or return.
ignoreErrors:
-
message: '#Function [a-zA-Z0-9\\_]+\(\) has parameter \$[a-zA-Z0-9\\_]+ with no typehint specified\.#'
paths:
- *.inc
- *.install
- *.module
- *.profile
- *.theme
-
message: '#Function [a-zA-Z0-9\\_]+\(\) has parameter \$[a-zA-Z0-9\\_]+ with no value type specified in iterable type [a-zA-Z0-9\\_]+\.#'
paths:
- *.inc
- *.install
- *.module
- *.profile
- *.theme
-
message: '#Function [a-zA-Z0-9\\_]+\(\) has no return typehint specified\.#'
paths:
- *.inc
- *.install
- *.module
- *.profile
- *.theme
-
message: '#Parameter \#1 \$label of method Drupal\\Core\\TypedData\\DataDefinition\:\:setLabel\(\) expects string, Drupal\\Core\\StringTranslation\\TranslatableMarkup given\.#'
paths:
- *.inc
- *.install
- *.module
- *.profile
- *.theme
- '#expects string\|null, Drupal\\Core\\StringTranslation\\TranslatableMarkup given\.#'
- '#expects string, Drupal\\Core\\StringTranslation\\TranslatableMarkup given\.#'
- '#expects string, Drupal\\Core\\StringTranslation\\TranslatableMarkup\|string given\.#'
- '#should return array\<string\> but returns array\<int, Drupal\\Core\\StringTranslation\\TranslatableMarkup\>\.#'
- '#should return string but returns Drupal\\Core\\StringTranslation\\TranslatableMarkup\.#'
- '#Parameter \#1 \$field of method Drupal\\Core\\Entity\\Query\\QueryInterface::condition\(\) expects Drupal\\Core\\Condition\\ConditionInterface\|string, Drupal\\Core\\Entity\\Query\\ConditionInterface given\.#'
inferPrivatePropertyTypeFromConstructor: true
level: max
reportUnmatchedIgnoredErrors: false
......@@ -73,7 +73,7 @@ class ExamplesLibraryController extends ControllerBase {
* @return \Drupal\Core\StringTranslation\TranslatableMarkup|string
* Example title.
*/
public function title(string $name): TranslatableMarkup|string {
public function title(string $name): string|TranslatableMarkup {
/** @var \Drupal\ui_examples\Definition\ExampleDefinition $example */
$example = $this->examplesManager->getDefinition($name);
return $example->getLabel();
......
......@@ -13,6 +13,7 @@ use Drupal\KernelTests\KernelTestBase;
* @group ui_examples
*/
class PluginTest extends KernelTestBase {
use StringTranslationTrait;
/**
......
name: 'UI Examples'
type: module
description: 'Define example pages from modules and themes.'
core_version_requirement: ^8.8 || ^9 || ^10
core_version_requirement: ^10
package: 'User interface'
......@@ -11,8 +11,9 @@ declare(strict_types = 1);
* Add new permission to access the library to all roles.
*/
function ui_examples_update_8101(): void {
$roles = \user_roles();
if (!empty($roles)) {
if (\Drupal::moduleHandler()->moduleExists('user')) {
$roles = \Drupal::entityTypeManager()->getStorage('user_role')
->loadMultiple();
foreach (\array_keys($roles) as $rid) {
\user_role_grant_permissions($rid, ['access_ui_examples_library']);
}
......
......@@ -10,7 +10,7 @@ declare(strict_types = 1);
/**
* Implements hook_theme().
*/
function ui_examples_theme() : array {
function ui_examples_theme(): array {
return [
'ui_examples_overview_page' => [
'variables' => ['examples' => NULL],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment