PathRedirect.php in Redirect 8
File
src/Plugin/migrate/process/PathRedirect.php
View source
<?php
namespace Drupal\redirect\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
class PathRedirect extends ProcessPluginBase {
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (preg_match('#^http#', $value[0])) {
$uri = $value[0];
}
else {
$uri = 'internal:/' . $value[0];
}
if (!empty($value[1])) {
$uri .= '?' . $value[1];
}
return $uri;
}
}
Classes
Name |
Description |
PathRedirect |
Plugin annotation
@MigrateProcessPlugin(
id = "d6_path_redirect"
) |