Explode values as keys

Created on 20 April 2019, over 5 years ago
Updated 14 September 2023, over 1 year ago

Hi,

I am creating a patch for a new feature for Explode plugin, this is to make an option to make the values as array keys. This solves the problem of having custom keys in the field settings, which triggers an error like "Illegal choice detected" on initial import.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇵🇭Philippines danielhonrade

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇪🇸Spain plopesc Valladolid

    This is a useful feature we have been using for a while.

    It also includes tests.

    Marking as RTBC.

  • Status changed to Needs work over 1 year ago
  • 🇳🇱Netherlands megachriz
    1. I see that there is a method added to the unit test class, but the feature that is provided here isn't actually tested. No test is calling getPluginWithKey().
    2. A case needs to be added to Drupal\Tests\tamper\Functional\Plugin\Tamper\ExplodeTest::formDataProvider() to ensure that the new setting gets saved. Existing cases need to be adjusted.
    3. The description of the setting could use an example. I had to inspect the code to understand what the setting was doing. Maybe change the description into "If enabled, the keys and values of the array will be the same: @code.". And "@code" will then be the code example, encapsulated in code-tags.
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    489 pass
  • 🇳🇿New Zealand ericgsmith

    Thank you for the patches and reviews.

    It also took me a while to understand what was expected based on the description. It feels like maybe this isn't something the explode plugin needs to be doing? But it seems like there is a valid use case here.

    Attaching a patch to include this as an additional plugin rather than introducing anything new into the explode plugin. Patch includes update to the chained tamper test to show them working together.

    This approach adds a little bit of complexity for the user who now has to add 2 plugins, but if this functionality is needed when using the explode plugin then it could well be useful in other contexts where we have an array from another source that is not the explode plugin.

Production build 0.71.5 2024