You are here

public function CckLink::transform in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/link/src/Plugin/migrate/process/d6/CckLink.php \Drupal\link\Plugin\migrate\process\d6\CckLink::transform()

Performs the associated process.

Parameters

mixed $value: The value to be transformed.

\Drupal\migrate\MigrateExecutableInterface $migrate_executable: The migration in which this process is being executed.

\Drupal\migrate\Row $row: The row from the source to process. Normally, just transforming the value is adequate but very rarely you might need to change two columns at the same time or something like that.

string $destination_property: The destination property currently worked on. This is only used together with the $row above.

Return value

string|array The newly transformed value.

Overrides ProcessPluginBase::transform

File

core/modules/link/src/Plugin/migrate/process/d6/CckLink.php, line 47
Contains \Drupal\link\Plugin\migrate\process\d6\CckLink.

Class

CckLink
Plugin annotation @MigrateProcessPlugin( id = "d6_cck_link" )

Namespace

Drupal\link\Plugin\migrate\process\d6

Code

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);
  }

  // Massage the values into the correct form for the link.
  $route['uri'] = $value['url'];
  $route['options']['attributes'] = $attributes;
  $route['title'] = $value['title'];
  return $route;
}