Remove occurrences for srcSetCandidateTemplate prop that no longer exists

Created on 30 July 2025, 2 months ago

Overview

In the issue 📌 Improve the front-end DX of Active , we removed the srcSetCandidateTemplate prop.

Even though there are some occurrences in the code base about srcSetCandidateTemplate. These don't affect the functionality, so we set the priority to minor, but those needs to be removed.

Here are the occurrences:

╰─ grep -rn srcSetCandidateTemplate *                                                                            ─╯
tests/modules/xb_test_sdc/components/image-srcset-candidate-template-uri/image-srcset-candidate-template-uri.component.yml:18:    srcSetCandidateTemplate:
tests/modules/xb_test_sdc/components/image-srcset-candidate-template-uri/image-srcset-candidate-template-uri.twig:13:  {% if widths and srcSetCandidateTemplate %}
tests/modules/xb_test_sdc/components/image-srcset-candidate-template-uri/image-srcset-candidate-template-uri.twig:14:    srcset="{% for width in widths %}{{ srcSetCandidateTemplate|replace({'{width}': width}) }} {{width}}w{% if not loop.last %}, {% endif %}{% endfor %}"
tests/src/Kernel/PropShapeToFieldInstanceTest.php:1448:            0 => '⿲xb_test_sdc:image-srcset-candidate-templae-uri␟srcSetCandidateTemplate',
tests/src/Kernel/FieldForComponentSuggesterTest.php:220:        '⿲xb_test_sdc:image-srcset-candidate-template-uri␟srcSetCandidateTemplate' => [
tests/src/Kernel/Plugin/ExperienceBuilder/ComponentSource/SingleDirectoryComponentTest.php:122:        'Experience Builder does not know of a field type/widget to allow populating the <code>srcSetCandidateTemplate

prop, with the shape {"type":"string","format":"uri-template","x-required-variables":["width"]}.',

Proposed resolution

- Remove the srcSetCandidateTemplate occurrences.
- Adapt tests.
- Replace image-srcset-candidate-template-uri.twig occurrence with src|toSrcSet code that appears in tests/modules/xb_test_sdc/components/image/image.twig

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain isholgueras

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

Comments & Activities

  • Issue created by @isholgueras
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    - Remove the srcSetCandidateTemplate occurrences.

    👎

    Please don't.

    What matters is that it's been removed from json-schema-definitions://experience_builder.module/image in /schema.json. That means all existing SDCs that use the XB-defined "image" prop shape won't get srcSetCandidateTemplate

    The only place where it occurs is in the image-srcset-candidate-template-uri test SDC, which was created intentionally, precisely to verify that matching against a DynamicPropSource that has a {"type":"string","format":"uri-template","x-required-variables":["width"]} shape still works.

    That was added in https://git.drupalcode.org/project/experience_builder/-/merge_requests/1....

    See

          'sdc.xb_test_sdc.image-srcset-candidate-template-uri' => [
            // This test SDC does indeed not have a corresponding StaticPropSource,
            // because its purpose is to test the ability for components to opt in
            // to consuming additional computed properties on a field instance.
            // See the `the image-srcset-candidate-template-uri component` test case
            // in FieldForComponentSuggesterTest.
            // @see \Drupal\Tests\experience_builder\Kernel\FieldForComponentSuggesterTest
            'Experience Builder does not know of a field type/widget to allow populating the <code>srcSetCandidateTemplate

    prop, with the shape {"type":"string","format":"uri-template","x-required-variables":["width"]}.',
    ],

    If you want, you can rename that prop in that test SDC, but I don't see why that's worth doing? 😅

  • 🇪🇸Spain isholgueras

    Oh, I see it now. Ok, make sense then. I thought it was leftover code.

    No, it doesn't make sense to rename it. I think it can be closed.

    Thanks!

Production build 0.71.5 2024