class ImageFile in Import 8
Same name and namespace in other branches
- 8.2 src/Plugin/migrate/source/ImageFile.php \Drupal\import\Plugin\migrate\source\ImageFile
Source for Image csv.
Plugin annotation
@MigrateSource(
id = "image_file"
)
Hierarchy
- class \Drupal\import\Plugin\migrate\source\ImageFile extends \Drupal\migrate_source_csv\Plugin\migrate\source\CSV
Expanded class hierarchy of ImageFile
File
- src/
Plugin/ migrate/ source/ ImageFile.php, line 20 - Contains \Drupal\import\Plugin\migrate\source\ImageFile.
Namespace
Drupal\import\Plugin\migrate\sourceView source
class ImageFile extends CSV {
public function prepareRow(Row $row) {
if ($image = $row
->getSourceProperty('File')) {
$base_path = dirname($this->configuration['path']) . '/images/';
// Setup our source/destination paths.
$path = $base_path . $image;
$destination_path = 'public://' . $image;
// Normally we would map CSV columns to these values, but to reduce
// complexity we assume paths and status.
$row
->setSourceProperty('filepath', $path);
$row
->setDestinationProperty('uri', $destination_path);
$row
->setDestinationProperty('status', 1);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ImageFile:: |
public | function |