5 * Contains \Drupal\redirect\Plugin\migrate\process\d7\PathRedirect.
8 namespace Drupal\redirect\Plugin\migrate\process\d7;
10 use Drupal\migrate\MigrateExecutableInterface;
11 use Drupal\migrate\ProcessPluginBase;
12 use Drupal\migrate\Row;
15 * @MigrateProcessPlugin(
16 * id = "d7_path_redirect"
19 class PathRedirect extends ProcessPluginBase {
24 * Transform the field as required for an iFrame field.
26 public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
28 // Check if the url begins with http.
29 if (preg_match('#^http#', $value[0])) {
34 // Make the link internal.
35 $uri = 'internal:/' . $value[0];
38 // Check if there are options.
39 if (!empty($value[1])) {
40 // Check if there is a query.
41 $options = unserialize($value[1]);
42 if (!empty($options['query'])) {
43 // Add it to the end of the url.
44 $uri .= '?' . http_build_query($options['query']);
46 if (!empty($options['fragment'])) {
47 $uri .= '#' . $options['fragment'];