Add deprecated and replaced_by properties for styles

Created on 17 October 2023, over 1 year ago
Updated 18 March 2024, 11 months ago

Problem/Motivation

Experiment with adding deprecated and replace_by style support for styles.

Proposed resolution

Add two new properties in style definition:

old-style:
  title: 'I am old and need of replacement'
  description: ''
  groups:
    - teaser
  deprecated: false
  replaced_by: new-style

Property `deprecated` will add '(Deprecated)' in the UI and also not allow this style to be attached to new paragraphs.

Property `replaced_by` will replace this style with a replaced by style in the rendering. This means that paragraphs that are using replaced styles will use now styles for replaced by style (CSS classes, template suggestions, etc).

Remaining tasks

- Discuss
- Test on real projects
- Figure if this is really needed

User interface changes

- Deprecated styles will not be selectable any more for new paragraphs.
- Deprecated styles will have additional text '(Deprecated)' in style name.

API changes

Two new properties are added to styles yaml definitions.

Method ParagraphsStylePlugin::getStyles() is getting a new $replaced_by boolean attribute:

public function getStyles(ParagraphInterface $paragraph, bool $replaced_by = TRUE) {}

Data model changes

None.

Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

🇷🇸Serbia pivica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024