You are here

public function BeerTerm::fields in Migrate Plus 8.4

Same name and namespace in other branches
  1. 8.5 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::fields()
  2. 8 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::fields()
  3. 8.2 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::fields()
  4. 8.3 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::fields()

Returns available fields on the source.

Return value

array Available fields in the source, keys are the field machine names as used in field mappings, values are descriptions.

Overrides MigrateSourceInterface::fields

File

migrate_example/src/Plugin/migrate/source/BeerTerm.php, line 45

Class

BeerTerm
This is an example of a simple SQL-based source plugin.

Namespace

Drupal\migrate_example\Plugin\migrate\source

Code

public function fields() {

  // This method simply documents the available source fields provided by the
  // source plugin, for use by front-end tools. It returns an array keyed by
  // field/column name, with the value being a translated string explaining
  // to humans what the field represents.
  $fields = [
    'style' => $this
      ->t('Beer style'),
    'details' => $this
      ->t('Style details'),
    'style_parent' => $this
      ->t('Parent style'),
    // These values are not currently migrated - it's OK to skip fields you
    // don't need.
    'region' => $this
      ->t('Region the style is associated with'),
    'hoppiness' => $this
      ->t('Hoppiness of the style'),
  ];
  return $fields;
}