Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / redirect / src / Plugin / migrate / process / d7 / RedirectSourceQuery.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\redirect\Plugin\migrate\process\d7\RedirectSourceQuery.
6  */
7
8 namespace Drupal\redirect\Plugin\migrate\process\d7;
9
10 use Drupal\migrate\MigrateExecutableInterface;
11 use Drupal\migrate\ProcessPluginBase;
12 use Drupal\migrate\Row;
13
14 /**
15  * @MigrateProcessPlugin(
16  *   id = "d7_redirect_source_query"
17  * )
18  */
19 class RedirectSourceQuery extends ProcessPluginBase {
20
21   /**
22    * {@inheritdoc}
23    *
24    * Transform the field as required for an iFrame field.
25    */
26   public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
27
28     // Check if there are options.
29     if (!empty($value)) {
30       // Check if there is a query.
31       $options = unserialize($value);
32       if (!empty($options['query'])) {
33         // Add it to the end of the url.
34         return serialize($options['query']);
35       }
36     }
37
38     return NULL;
39   }
40
41 }