This module allows:

  • developers to define styles (simple lists of concurrent CSS classes) from modules and themes
  • site builders to use those styles on blocks and section from Layout Builder interface (with ui_styles_layout_builder)
  • everyone to browse styles from a library page (with ui_styles_library)

Inspired by layout_builder_styles module, with those differences:

  • styles are plugin-based instead of being config-entity-based, to be created and managed by the themer (inside a YML file), and then only used by the site builder in the layout builder interface (see also: #3107972)
  • styles are organized as groups of classes, because some styles should only allow one class to be chosen (see also: #3075502)
  • with a preview page, like ui_patterns_library, available there: /styles
  • on rendering, classes are attached to the first render array inside the block, instead of being attached to the block wrapper
  • it is possible to add free extra classes, using a simple text field

Project link

https://www.drupal.org/project/ui_styles

Git instructions

git clone --branch 8.x-1.x https://git.drupalcode.org/project/ui_styles.git

PAReview checklist

https://pareview.sh/pareview/https-git.drupal.org-project-ui_styles.git

Comments

pdureau created an issue. See original summary.

avpaderno’s picture

Issue summary: View changes

Thank you for applying! I added the PAReview checklist link. Reviewers will check the project and post comments to list what should be changed.

If you haven't done it, yet, please check the PAReview report and fix what needs to be fixed. There could be some false positives; verify that what reported is correct, before making any change.

avpaderno’s picture

Status: Needs review » Needs work

At a quick review, I didn't find any security issues. There are some small coding standard issues to fix, reported from PAReview.

name: UI Styles
description: Define styles from modules and themes,.
core: 8.x
core_version_requirement: ^8 || ^9
package: User interface
type: module

Since the composer.json file is setting the minimum Drupal version to 8.8, also the .info file should report the same requirement. (core_version_requirement works also with ^8 || ^9.) (There is also a comma before the period that should be removed, in the module description.)

The LICENSE.txt file is not necessary, as any module hosted on drupal.org is licensed under the same license used by Drupal.

/**
 * Implementation of hook_element_info_alter().
 *
 */

It should be Implements hook_element_info_alter().

rohitrajputsahab’s picture

StatusFileSize
new24.1 KB

Found "doc" folder.
Please remove this folder. Please see attached screenshot.

rohitrajputsahab’s picture

Remove comma in *.info.yml file. Please see below

description: Define styles from modules and themes,.

ankush_03’s picture

Still some pareview issue pending :

FILE: ...000000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/README.md
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------
8 | WARNING | Line exceeds 80 characters; contains 94 characters
9 | WARNING | Line exceeds 80 characters; contains 121 characters
14 | WARNING | Line exceeds 80 characters; contains 131 characters
16 | WARNING | Line exceeds 80 characters; contains 287 characters
17 | WARNING | Line exceeds 80 characters; contains 197 characters
18 | WARNING | Line exceeds 80 characters; contains 155 characters
19 | WARNING | Line exceeds 80 characters; contains 127 characters
27 | WARNING | Line exceeds 80 characters; contains 125 characters
60 | WARNING | Line exceeds 80 characters; contains 439 characters
--------------------------------------------------------------------------

FILE: ...view_temp/modules/ui_styles_library/ui_styles_library.links.menu.yml
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
5 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

FILE: ...emp/modules/ui_styles_layout_builder/ui_styles_layout_builder.module
--------------------------------------------------------------------------
FOUND 6 ERRORS AND 4 WARNINGS AFFECTING 10 LINES
--------------------------------------------------------------------------
118 | ERROR | [x] Expected 1 blank line after function; 2 found
122 | WARNING | [ ] Format should be "* Implements hook_foo().", "*
| | Implements hook_foo_BAR_ID_bar() for xyz_bar().",,
| | "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.html.twig.", "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "*
| | Implements hook_foo_BAR_ID_bar() for block
| | templates."
124 | ERROR | [x] Whitespace found at end of line
126 | ERROR | [x] Whitespace found at end of line
127 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
161 | WARNING | [ ] Format should be "* Implements hook_foo().", "*
| | Implements hook_foo_BAR_ID_bar() for xyz_bar().",,
| | "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.html.twig.", "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "*
| | Implements hook_foo_BAR_ID_bar() for block
| | templates."
163 | ERROR | [x] Whitespace found at end of line
165 | ERROR | [x] Whitespace found at end of line
166 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
182 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

Time: 1.16 secs; Memory: 4Mb

avpaderno’s picture

The doc directory contains the image linked from the README.md file. Modules can have any directory they need and the Drupal coding standards don't vet the use of such directories.

pdureau’s picture

HI @kiamlaluno,

Thanks for your review.

I will do those changes:
- Removal of the comma before the period in the module description.
- Implements hook_element_info_alter().
- Minimum Drupal version to 8.8 in core_version_requirement

Other subjects:
- Yes, the doc directory is needed for the README.md
- I will keep LICENSE.txt because I host this module also on Github

PARview subjects: I run PHPCS with Drupal and Drupal Practice on my local environment, and I don't see those reports.
I will fix some.

pdureau’s picture

Assigned: Unassigned » pdureau
avpaderno’s picture

Assigned: pdureau » Unassigned
rohitrajputsahab’s picture

Pareviewsh issue is still pending. Please fix this.

FILE: ...000000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/README.md
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
--------------------------------------------------------------------------
8 | WARNING | Line exceeds 80 characters; contains 94 characters
9 | WARNING | Line exceeds 80 characters; contains 121 characters
14 | WARNING | Line exceeds 80 characters; contains 131 characters
16 | WARNING | Line exceeds 80 characters; contains 287 characters
17 | WARNING | Line exceeds 80 characters; contains 197 characters
18 | WARNING | Line exceeds 80 characters; contains 155 characters
19 | WARNING | Line exceeds 80 characters; contains 127 characters
27 | WARNING | Line exceeds 80 characters; contains 125 characters
60 | WARNING | Line exceeds 80 characters; contains 439 characters
--------------------------------------------------------------------------

FILE: ...emp/modules/ui_styles_layout_builder/ui_styles_layout_builder.module
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------
127 | WARNING | Line exceeds 80 characters; contains 81 characters
166 | WARNING | Line exceeds 80 characters; contains 81 characters
--------------------------------------------------------------------------

Time: 1.23 secs; Memory: 6Mb

avpaderno’s picture

Priority: Normal » Minor
avpaderno’s picture

Status: Needs work » Closed (won't fix)

I am closing this application due to lack of replies.