This module provides a field type that allows editors to easily apply selected CSS classes to paragraphs. This helps in styling different paragraph instances on a page.
Overview
Classy paragraphs ships a new field type "Class list" which allows an editor to apply a selected class to paragraphs via a drop-down list.
Installation
Drupal 7
- Enable Classy paragraphs
- Add "Class list" field to desired paragraph type
- Defines classes by implementing the the hook_classy_paragraphs_list_options hook.
Optional:
- Install classy_paragraphs_ui to manage classes from a user interface. Thanks go to Mark Breneman for writing this useful module.
Drupal 9
- Enable Classy paragraphs
- Go to admin/structure/classy_paragraphs_style and create a style.
- Create a reference field and target "classy paragraphs style."
- Select style and the classes should appear.
How It Works
Drupal 7
This module allows an editor to select a class, via a drop-down list, which is added to the paragraph template.
The class is added to the template via the classy_paragraphs_preprocess_entity preprocess function. In this function we use classy_paragraphs_get_class to pull out the selected class from the paragraph_item entity. Once we have a class, then we add it to the template using $variables['classes_array'].
Drupal 9
We've refactored the module so it uses Drupal 8's new config entity. By doing this we can export CSS classes (called styles), we get a UI to manage the classes and NO MORE hooks. Also, you can add multiple classes to a single style.
NOTE: The module won't work if you're using Display Suite or Panelizer to configure the paragraphs. Integration will come later.
Requirements
Upgrades
While this modules is in alpha, there will be no database upgrade support.
Demo
Check out our Paragraphs demo site to see this module in action.
πΊπ¦
This module is maintained by Ukrainian developers.Please consider supporting Ukraine in a fight for their freedom and safety of Europe.
Ask your assistant about Classy paragraphs
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
Required by
1 tracked project depends on this one
- Paragraphs Bootstrap Layouts 54 sites
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.0.0 | Stable | 8β11 | Sep 5, 2024 | ||
| 2.x-dev | Dev | 8β11 | Sep 5, 2024 | ||
| 8.x-1.0-rc3 | Pre-release | 8β11 | May 16, 2024 | ||
| 8.x-1.0-rc2 | Pre-release | 8β10 | Apr 21, 2023 |