Allow cardinality other than 1

Created on 7 January 2025, 17 days ago

Problem/Motivation

With this module its not possible to us cardinality other than 1.

Steps to reproduce

1. Install Drupal core 11.x and enable svg_icon_field module.
2. Add svg_icon field to article node, set cardinality to unlimited.
3. Create a new node, try to add more than one icon to field.
4. Face the ajax error.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇮Finland sokru

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

Merge Requests

Comments & Activities

  • Issue created by @sokru
  • 🇫🇮Finland sokru

    Created a MR that fixes the issue, but this module would greatly benefit for tests for this feature.

  • Pipeline finished with Success
    17 days ago
    Total: 155s
    #388449
  • First commit to issue fork.
  • Pipeline finished with Failed
    2 days ago
    Total: 188s
    #401971
  • 🇺🇦Ukraine dlevchik

    Tested manually, fixed attributions display for multiple cardinality fields. Created first FunctionalJavascriptTests test - NodeAjaxTest. The idea is to fill the field on test, wait for AJAX to finish, check the icon and save the node. Test this with the assertions. Later, create AJAX test for multiple cardinality fields.

    The problem is, since I don't have a lot of experience with testing, the test is currently fails:
    Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for field.storage.node.svg_test_field with the following errors: field.storage.node.svg_test_field:settings.max_length missing schema, field.storage.node.svg_test_field:settings.source missing schema, field.storage.node.svg_test_field:settings.is_ascii missing schema, field.storage.node.svg_test_field:settings.case_sensitive missing schema

    I can't wrap my head on how to fix it. I've used some other core modules as an examples, and they don't seem to use any specific fixes for this error

    Would greatly appreciate the help!

  • 🇺🇦Ukraine dlevchik

    Fixed module settings schema by providing svg_icon_field.schema.yml, fixed the test and added multiple cardinality test.

    Time: 00:11.304, Memory: 10.00 MB

    OK (2 tests, 20 assertions)

    Since I'm no test guru at all, I kindly ask to review and point out the issues

  • Pipeline finished with Success
    1 day ago
    Total: 256s
    #402702
  • 🇵🇱Poland dawid_nawrot

    I'm not an expert in test either, but thanks for contribution. Maybe someone who is more familiar with testing will show up and confirm if this is fine and if so I will merge it and prepare new release.

Production build 0.71.5 2024