X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flink%2Fsrc%2FPlugin%2Fmigrate%2Fprocess%2Fd6%2FFieldLink.php;fp=web%2Fcore%2Fmodules%2Flink%2Fsrc%2FPlugin%2Fmigrate%2Fprocess%2Fd6%2FFieldLink.php;h=19c5e35ef99961b567ad78a80be96be91adf0bd3;hp=4badcb6c66e5eda3c9e2eeba917d5b72e4431f16;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/link/src/Plugin/migrate/process/d6/FieldLink.php b/web/core/modules/link/src/Plugin/migrate/process/d6/FieldLink.php index 4badcb6c6..19c5e35ef 100644 --- a/web/core/modules/link/src/Plugin/migrate/process/d6/FieldLink.php +++ b/web/core/modules/link/src/Plugin/migrate/process/d6/FieldLink.php @@ -2,85 +2,16 @@ namespace Drupal\link\Plugin\migrate\process\d6; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\Plugin\MigrationInterface; -use Drupal\migrate\MigrateExecutableInterface; -use Drupal\migrate\ProcessPluginBase; -use Drupal\migrate\Row; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\link\Plugin\migrate\process\FieldLink as GeneralPurposeFieldLink; + +@trigger_error('FieldLink is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\link\Plugin\migrate\process\FieldLink instead.', E_USER_DEPRECATED); /** * @MigrateProcessPlugin( * id = "d6_field_link" * ) + * + * @deprecated in Drupal 8.4.x, to be removed before Drupal 9.0.x. Use + * \Drupal\link\Plugin\migrate\process\FieldLink instead. */ -class FieldLink extends ProcessPluginBase implements ContainerFactoryPluginInterface { - - /** - * {@inheritdoc} - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->migration = $migration; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $migration - ); - } - - /** - * Turn a Drupal 6 URI into a Drupal 8-compatible format. - * - * @param string $uri - * The 'url' value from Drupal 6. - * - * @return string - * The Drupal 8-compatible URI. - * - * @see \Drupal\link\Plugin\Field\FieldWidget\LinkWidget::getUserEnteredStringAsUri() - */ - protected function canonicalizeUri($uri) { - // If we already have a scheme, we're fine. - if (empty($uri) || !is_null(parse_url($uri, PHP_URL_SCHEME))) { - return $uri; - } - - // Remove the component of the URL. - if (strpos($uri, '') === 0) { - $uri = substr($uri, strlen('')); - } - - // Add the internal: scheme and ensure a leading slash. - return 'internal:/' . ltrim($uri, '/'); - } - - /** - * {@inheritdoc} - */ - public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { - $attributes = unserialize($value['attributes']); - // Drupal 6 link attributes might be double serialized. - if (!is_array($attributes)) { - $attributes = unserialize($attributes); - } - - if (!$attributes) { - $attributes = []; - } - - // Massage the values into the correct form for the link. - $route['uri'] = $this->canonicalizeUri($value['url']); - $route['options']['attributes'] = $attributes; - $route['title'] = $value['title']; - return $route; - } - -} +class FieldLink extends GeneralPurposeFieldLink {}