Пример #1
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;
     }
 }