ImageCachePreset.php in Drupal 10
File
core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php
View source
<?php
namespace Drupal\image\Plugin\migrate\source\d6;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
use Drupal\migrate\Row;
class ImageCachePreset extends DrupalSqlBase {
public function query() {
$query = $this
->select('imagecache_preset', 'icp')
->fields('icp');
return $query;
}
public function fields() {
$fields = [
'presetid' => $this
->t('Preset ID'),
'presetname' => $this
->t('Preset Name'),
];
return $fields;
}
public function getIds() {
$ids['presetid']['type'] = 'integer';
return $ids;
}
public function prepareRow(Row $row) {
$actions = [];
$results = $this
->select('imagecache_action', 'ica')
->fields('ica')
->condition('presetid', $row
->getSourceProperty('presetid'))
->execute();
foreach ($results as $key => $result) {
$actions[$key] = $result;
$actions[$key]['data'] = unserialize($result['data']);
}
$row
->setSourceProperty('actions', $actions);
return parent::prepareRow($row);
}
}