/**
* Processes a link path into an 'internal:' or 'entity:' URI.
*
+ * @todo: Add documentation in https://www.drupal.org/node/2954908
+ *
* @MigrateProcessPlugin(
* id = "link_uri"
* )
* The entity type manager, used to fetch entity link templates.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {
+ $configuration += [
+ 'validate_route' => TRUE,
+ ];
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager;
}
}
}
else {
- throw new MigrateException(sprintf('The path "%s" failed validation.', $path));
+ // If the URL is not routed, we might want to get something back to do
+ // other processing. If this is the case, the "validate_route"
+ // configuration option can be set to FALSE to return the URI.
+ if (!$this->configuration['validate_route']) {
+ return $url->getUri();
+ }
+ else {
+ throw new MigrateException(sprintf('The path "%s" failed validation.', $path));
+ }
}
}
return $path;