Add migrate process plugin for concatenating the value with a string

Created on 31 March 2018, about 7 years ago
Updated 25 August 2022, almost 3 years ago

We have Concat for concatenating source strings together, but we currently have no way to prefix or suffix values with strings from a provided configuration.

Patch coming shortly, with documentation explaining how this can work.

Feature request
Status

Closed: works as designed

Version

8.6 ⚰️

Component
Migration 

Last updated about 15 hours ago

Created by

🇨🇦Canada colan Toronto 🇨🇦

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.

  • 🇨🇦Canada darkodev

    I don't only post on d.o. for others, but for myself when I forget how I did things :-)

    An example of concatenating a file description value with the node title and a constant using include_source (after trying a whole bunch of process chains that did not work). There could be a better way, but I haven't found it.

    Hope this help someone further.

    source:
      constants:
        factsheet: 'Factsheet'
    
    field_file:
      - plugin: sub_process
        include_source: true
        source_key: node_source
        source: field_some_file
        process:
          target_id: fid
          display: display
          description:
            - plugin: concat
              source:
                - 'node_source/title'
                - 'node_source/constants/factsheet'
              delimiter: ' '
    
  • 🇩🇰Denmark ressa Copenhagen

    I was looking for a simple way of wrapping latitude longitude values for WKT format, and this worked well. Sure, I should probably have programmed a custom solution, but this works fine:

    source:
    [...]
      constants:
        wkt_prefix: 'POINT('
        wkt_separator: ' '
        wkt_suffix: ')'
    
    process:
      title: name
      field_map_position:
        plugin: concat
        source:
          - 'constants/wkt_prefix'
          - lon
          - 'constants/wkt_separator'
          - lat
          - 'constants/wkt_suffix'
    
Production build 0.71.5 2024