Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294882

Add Trim Process Plugin

$
0
0

Problem/Motivation

When dealing with content users can sometimes add extra characters such as extra whitespace or whatever, adding a process plugin using php's trim, rtrim, and ltrim functions would be very helpful in these cases.

Proposed resolution

Add a process plugin to handle cases where trim is needed.

source:
  plugin: some_plugin
  contants:
    field_first: "   FirstName  "
    field_last: "LastName -"
process:
  first_name:
    plugin: trim
    source: constants/field_first
  last_name:
    plugin: trim
    source: constants/field_last
    character_mask: " -"
  name:
    plugin: concat
    source: 
      - "@first_name"
      - "@last_name"
    delimter: ""

results in name value: "FirstName LastName"

Viewing all articles
Browse latest Browse all 294882

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>