Hi,

I'd like to change the rewrite plugin of the Feeds Tamper module in order to apply logic...

I'm actually implementing a Drupal site with the structure "Place" which have the following Geo fields from NGA (http://earth-info.nga.mil/gns/html/gis_countryfiles.html) (detailed description at http://earth-info.nga.mil/gns/html/gis_countryfiles.html).

"Place" content type

  • Title (default)
  • RC (field_place_rc, List/integer)
  • UFI (field_place_ufi, Integer)
  • LAT/LONG (field_place_latitude_longitude, Geofield - Latitude / Longitude)
  • JOG (field_place_jog, Text)
  • FC (field_place_fc, List/text)
  • DSG (field_place_dsg, List/text)
  • PC (field_place_pc, List/text)
  • CC1 (field_place_cc1, List/text)
  • ADM1 (field_place_adm1, Text)
  • Places (field_places_collection, Field collection)

"Place detail" field collection type

  • UNI (field_place_uni, Integer)
  • CC2 (field_place_cc2, List/text)
  • NT (field_place_nt, List/text)
  • LC (field_place_language, Language)
  • FULL_NAME_ND_RO (field_place_name, text)

with this structure, I'll have one node defining a place (e.g. a city), and details stored in the field collection (e.g. for Milan, we can manage alternative names such as Milan, Milano, Mediolanum, etc with a single entry point).

I've created two feeds importer (one for "Place" and one for Place detail) in order to get data from the csv files.

I'd like to get all entries without modify the original files (the idea is to automatic download and process this files), and the "Title" field should reflect the best option. I've used the Feeds Tamper's Rewrite plugin to add info in the title ([field_place_name] ([field_place_cc1]) -> Milan (IT)) to avoid confusion searching for a place, but the system overwrite this field with the last element.

In the specific case of Milano, the last field is "Mediolanum", but this is not the name usually used... I need to solve two issues:

  1. Acces to the external importer "Place detail" to get "field_name_nt" and use it in the "Place" importer
  2. Modify the rewrite plugin to add logic such as
  • If NT="C" Then overwrite field (using rewrite plugin)
  • If NT="N" And LC="ita" Then overwrite field for the translated node language "ita"

This last is tto complex and it's not important such as the first...

Any help? every comment is welcome.

TIA

Comments

blakefrederick’s picture

The Feeds Tamper Conditional module may be what you're looking for.