SourcePluginExtension.php in Migrate Plus 8.2
File
src/Plugin/migrate/source/SourcePluginExtension.php
View source
<?php
namespace Drupal\migrate_plus\Plugin\migrate\source;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
abstract class SourcePluginExtension extends SourcePluginBase {
protected $fields = [];
protected $ids = [];
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
$this->fields = $configuration['fields'];
$this->ids = $configuration['ids'];
}
public function fields() {
$fields = [];
foreach ($this->fields as $field_info) {
$fields[$field_info['name']] = isset($field_info['label']) ? $field_info['label'] : $field_info['name'];
}
return $fields;
}
public function getIds() {
return $this->ids;
}
}