Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
 {
     $field_type = is_array($value) ? $value[0] : $value;
     try {
         return $this->cckPluginManager->createInstance($field_type, [], $this->migration)->getFieldType($row);
     } catch (PluginNotFoundException $e) {
         return parent::transform($value, $migrate_executable, $row, $destination_property);
     }
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
 {
     // Set the destination region, based on the source region and theme as well
     // as the current destination default theme.
     list($source_theme, $destination_theme, $region) = $value;
     // Theme is the same on both source and destination, so ensure that the
     // region exists in the destination theme.
     if (strtolower($source_theme) == strtolower($destination_theme)) {
         if (isset($this->regions[$destination_theme][$region])) {
             return $region;
         }
     }
     // Fall back to static mapping.
     return parent::transform($value, $migrate_executable, $row, $destination_property);
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property)
 {
     $plugin_id = parent::transform($value, $migrate_executable, $row, $destination_property);
     // If the static map is bypassed on failure, the returned plugin ID will be
     // an array if $value was. Plugin IDs cannot be arrays, so flatten it before
     // passing it into the filter manager.
     if (is_array($plugin_id)) {
         $plugin_id = implode(':', $plugin_id);
     }
     if ($this->filterManager->hasDefinition($plugin_id)) {
         return $plugin_id;
     } else {
         $fallback = $this->filterManager->getFallbackPluginId($plugin_id);
         $message = $this->t('Filter @plugin_id could not be mapped to an existing filter plugin; defaulting to @fallback.', ['@plugin_id' => $plugin_id, '@fallback' => $fallback]);
         $migrate_executable->saveMessage((string) $message, MigrationInterface::MESSAGE_WARNING);
         return $fallback;
     }
 }