transformKey example



    if (is_array($value) || $value instanceof \Traversable) {
      foreach ($value as $key => $new_value) {
        if (!is_array($new_value)) {
          throw new MigrateException(sprintf("Input array should hold elements of type array, instead element was of type '%s'", gettype($new_value)));
        }
        $new_row = new Row($new_value + $source);
        $migrate_executable->processRow($new_row$this->configuration['process']);
        $destination = $new_row->getDestination();
        if (array_key_exists('key', $this->configuration)) {
          $key = $this->transformKey($key$migrate_executable$new_row);
        }
        // Do not save the result if the key is NULL. The configured process         // pipeline used in transformKey() will return NULL if a         // MigrateSkipProcessException is thrown.         // @see \Drupal\filter\Plugin\migrate\process\FilterID         if ($key !== NULL) {
          $return[$key] = $destination;
        }
      }
    }
    return $return;
  }
Home | Imprint | This part of the site doesn't use cookies.