- Issue created by @pivica
- Status changed to Needs review
over 1 year ago 3:25pm 17 October 2023 - last update
over 1 year ago 21 pass, 12 fail - 🇷🇸Serbia pivica
Here is a first patch.
If we decide that this is useful we will need to add some test coverage also.
The last submitted patch, 2: 3394637-style-deprecated-replaced-by-2.patch, failed testing. View results →
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- last update
over 1 year ago 21 pass, 12 fail - 🇷🇸Serbia pivica
Found a bug when editing a paragraph that has a style which is replaced now in select box you would get replaced by style instead of manually selecting some other style. This patch is fixing this.
No idea about failed tests, they don't look related to this.
The last submitted patch, 4: 3394637-style-deprecated-replaced-by-3.patch, failed testing. View results →
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- last update
over 1 year ago 36 pass - last update
over 1 year ago Composer require-dev failure - Status changed to Needs work
over 1 year ago 7:10am 19 October 2023 - 🇨🇭Switzerland berdir Switzerland
The test fails are a PHP version issue, looks like blazy broke compatibility with PHP 7.3 and we'll need to update that.
+++ b/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php @@ -363,19 +373,31 @@ class ParagraphsStylePlugin extends ParagraphsBehaviorBase implements ContainerF + // If style is replaced_by and replaced_by style exist and is enabled + // then replace it by new style. + if ($replaced_by && !empty($style_config['replaced_by'])) { + $enabled_styles = \Drupal::config('paragraphs_collection.settings')->get('enabled_styles'); + if (in_array($style_config['replaced_by'], $enabled_styles) && $replaced_style = $this->yamlStyleDiscovery->getStyle($style_config['replaced_by'])) { + $style = $replaced_style['name'];
yamlStyleDiscovery->getStyle() already verifies that it is enabled, you don't need to duplicate that.
- Status changed to Needs review
over 1 year ago 12:21pm 19 October 2023 - last update
over 1 year ago 21 pass, 12 fail The last submitted patch, 8: 3394637-style-deprecated-replaced-by-8.patch, failed testing. View results →
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- Status changed to Needs work
11 months ago 8:53pm 18 March 2024 - 🇨🇭Switzerland berdir Switzerland
Notes on implementing a test for this:
create a deprecated and replaced_by style definition
create a paragraph with that style and put it in a node through the API. You can find examples doing that in _paragraphs_collection_demo_create_demo_article()
visit that node, verify the specified replacement style is used
edit the node, verify the deprecated style is shown, change it, save, edit again, verify it doesn't show up anymore.