CckIframe.php in Iframe 8
File
src/Plugin/migrate/process/d6/CckIframe.php
View source
<?php
namespace Drupal\iframe\Plugin\migrate\process\d6;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
use Symfony\Component\DependencyInjection\ContainerInterface;
class CckIframe extends ProcessPluginBase implements ContainerFactoryPluginInterface {
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->migration = $migration;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
return new static($configuration, $plugin_id, $plugin_definition, $migration);
}
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$attributes = unserialize($value['attributes']);
if (!is_array($attributes)) {
try {
$attributes = unserialize($attributes);
} catch (Exception $e) {
$attributes = [];
}
}
foreach ($attributes as $akey => $aval) {
if (isset($akey)) {
$route[$akey] = (string) $aval;
}
}
$route['url'] = (string) $value['url'];
$route['title'] = (string) $value['title_value'];
$route['tokensupport'] = (int) $value['enable_tokens'];
return $route;
}
}