Пример #1
0
 /**
  * Runs a process pipeline on each destination list item.
  */
 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
 {
     $return = array();
     if (!is_array($value)) {
         $value = [$value];
     }
     // All processes are applied to a single field.
     $process = [$this->configuration['process']];
     foreach ($value as $key => $new_value) {
         $new_row = new Row(array(), array());
         $migrate_executable->processRow($new_row, $process, $new_value);
         $destination = $new_row->getDestination();
         // Getting the last value from the process chain.
         $return[$key] = end($destination);
     }
     return $return;
 }
Пример #2
0
 /**
  * Runs the process pipeline for the current key.
  *
  * @param string|int $key
  *   The current key.
  * @param \Drupal\migrate\MigrateExecutableInterface $migrate_executable
  *   The migrate executable helper class.
  * @param \Drupal\migrate\Row $row
  *   The current row after processing.
  *
  * @return mixed
  *   The transformed key.
  */
 protected function transformKey($key, MigrateExecutableInterface $migrate_executable, Row $row)
 {
     $process = array('key' => $this->configuration['key']);
     $migrate_executable->processRow($row, $process, $key);
     return $row->getDestinationProperty('key');
 }