You are here

public function LinkOptions::transform in Drupal 10

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

mixed The newly transformed value.

Overrides ProcessPluginBase::transform

File

core/modules/menu_link_content/src/Plugin/migrate/process/LinkOptions.php, line 33

Class

LinkOptions
Converts links options.

Namespace

Drupal\menu_link_content\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
  if (isset($value['query'])) {

    // If the query parameters are stored as a string (as in D6), convert it
    // into an array.
    if (is_string($value['query'])) {
      parse_str($value['query'], $old_query);
    }
    else {
      $old_query = $value['query'];
    }
    $value['query'] = $old_query;
  }
  return $value;
}