I am using Migrate CSV to migrate sharepoint nodes from a csv file into Drupal 8
I need to strip part of the page titles. An example page title is about.aspx. I want to strip the .aspx
Right now I am doing a straight mapping like this= title: title. Is there a plugin that can strip this out?
I know I could do a search and replace in the csv file but I feel its safer to remove in the processing.
I have looked here but cannot find one.
https://www.drupal.org/docs/8/api/migrate-api/migrate-process/
also is there a plugin that can add content. Or Prefix and Suffix. Example is the body section I am mapping over straight has no html. I would like to Prefix and Suffix the paragraph tag <p>my body section needs html tags</p>
Comments
callback process plugin probably not sufficient: write own?
I used the callback plugin for simple conversion by calling into PHP.
I am still a PHP beginner so I don't know if there is something like "remove extension".
However, writing your own process plugin is not too difficult:
here is an example which transforms a date (I guess PHP has
the primitives you need to find a '.' from behind and cut
the string up to that position .. in fact it's basically what I did,
but for a very different purpose .. you may prefer to change
the name of the plugin, though :-) ..).
If you want to see the complete example
(module which contains the plugin):
I published it as GPL: https://www.drupal.org/node/2810683