3 namespace Drupal\migrate_plus\Plugin\migrate\source;
5 use Drupal\migrate\Plugin\MigrationInterface;
6 use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
9 * Generally-useful extensions to the core SourcePluginBase.
11 abstract class SourcePluginExtension extends SourcePluginBase {
14 * Information on the source fields to be extracted from the data.
17 * Array of field information keyed by field names. A 'label' subkey
18 * describes the field for migration tools; a 'path' subkey provides the
19 * source-specific path for obtaining the value.
21 protected $fields = [];
24 * Description of the unique ID fields for this source.
27 * Each array member is keyed by a field name, with a value that is an
28 * array with a single member with key 'type' and value a column type such
36 public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
37 parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
38 $this->fields = $configuration['fields'];
39 $this->ids = $configuration['ids'];
45 public function fields() {
47 foreach ($this->fields as $field_info) {
48 $fields[$field_info['name']] = isset($field_info['label']) ? $field_info['label'] : $field_info['name'];
56 public function getIds() {