class EmptySource
Same name in this branch
- 9 core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php \Drupal\migrate_drupal\Plugin\migrate\source\EmptySource
Same name and namespace in other branches
- 11.x core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php \Drupal\migrate_drupal\Plugin\migrate\source\EmptySource
- 11.x core/modules/migrate/src/Plugin/migrate/source/EmptySource.php \Drupal\migrate\Plugin\migrate\source\EmptySource
- 10 core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php \Drupal\migrate_drupal\Plugin\migrate\source\EmptySource
- 10 core/modules/migrate/src/Plugin/migrate/source/EmptySource.php \Drupal\migrate\Plugin\migrate\source\EmptySource
- 8.9.x core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php \Drupal\migrate_drupal\Plugin\migrate\source\EmptySource
- 8.9.x core/modules/migrate/src/Plugin/migrate/source/EmptySource.php \Drupal\migrate\Plugin\migrate\source\EmptySource
Source returning a row based on the constants provided.
Example:
source:
plugin: empty
constants:
entity_type: user
field_name: image
This will return a single row containing 'constants/entity_type' and 'constants/field_name' elements, with values of 'user' and 'image', respectively.
For additional configuration keys, refer to the parent class:
Plugin annotation
@MigrateSource(
id = "empty",
source_module = "migrate"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\migrate\Plugin\migrate\source\SourcePluginBase implements \Drupal\migrate\Plugin\MigrateSourceInterface, \Drupal\migrate\Event\RollbackAwareInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\migrate\Plugin\migrate\source\EmptySource extends \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
- class \Drupal\migrate\Plugin\migrate\source\SourcePluginBase implements \Drupal\migrate\Plugin\MigrateSourceInterface, \Drupal\migrate\Event\RollbackAwareInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of EmptySource
See also
\Drupal\migrate\Plugin\migrate\source\SourcePluginBase
1 file declares its use of EmptySource
- EmptySource.php in core/
modules/ migrate_drupal/ src/ Plugin/ migrate/ source/ EmptySource.php
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ source/ EmptySource.php, line 30
Namespace
Drupal\migrate\Plugin\migrate\sourceView source
class EmptySource extends SourcePluginBase {
/**
* {@inheritdoc}
*/
public function fields() {
return [
'id' => $this->t('ID'),
];
}
/**
* {@inheritdoc}
*/
public function initializeIterator() {
return new \ArrayIterator([
[
'id' => '',
],
]);
}
/**
* Allows class to decide how it will react when it is treated like a string.
*/
public function __toString() {
return '';
}
/**
* {@inheritdoc}
*/
public function getIds() {
$ids['id']['type'] = 'string';
return $ids;
}
/**
* {@inheritdoc}
*/
protected function doCount() {
return 1;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.