How to access array elements?

Created on 30 April 2023, over 1 year ago
Updated 28 October 2023, about 1 year ago

Problem/Motivation

I don't see a tamper that works off the Explode tamper to allow picking which array element is required. Am i missing something?

I do see this very old D7 issue which was providing this functionality: #1819986: Add a plugin for reducing an array to a single element β†’ , but doesn't look like it ever made it in to D7 or D8.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada liquidcms

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

  • Issue created by @liquidcms
  • πŸ‡¨πŸ‡¦Canada liquidcms

    On the down side we seem to have lost a lot of tampers from D7; on the plus side, its pretty easy to create your own. Found a lot of old docs on D7 and some for D8 which don't include creating new Tamper (not Feeds or Feeds Tamper) plugins. Easiest is to look at the existing tamper plugins that come with the Tamper module.

    I attached one that i created for selecting array elements.

  • Status changed to Needs work over 1 year ago
  • πŸ‡³πŸ‡±Netherlands megachriz

    Thanks for your contribution! In order for this to be added to the module, the following is needed:

    • Config schema for the plugin's settings
    • A unit test
    • A functional test

    You say that you've lost a lot of Tamper plugins. Which plugins are you missing? According to #2958013: [META] port remaining feeds tamper plugins β†’ there are only two that aren't completely ported yet from the D7 version of Feeds Tamper.

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    Patch Failed to Apply
  • πŸ‡ΊπŸ‡ΈUnited States hlopez

    Added schema, functional, and unit tests. Updated some of the functionality to do what the non integer selectors describe. If the functionality in the original patch is preferred then the non integer selectors should probably be updated to be more accurate.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update about 1 year ago
    550 pass
  • πŸ‡ΊπŸ‡ΈUnited States hlopez

    Rebased patch off dev branch instead of release branch.

Production build 0.71.5 2024