3 namespace Drupal\migrate_plus\Plugin\Discovery;
5 use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
6 use Drupal\Component\Plugin\Discovery\DiscoveryTrait;
9 * Allows configuration entities to define plugin definitions.
11 class ConfigEntityDiscovery implements DiscoveryInterface {
16 * Entity type to query.
20 protected $entityType;
23 * Construct a YamlDiscovery object.
25 * @param string $entity_type
26 * The entity type to query for.
28 function __construct($entity_type) {
29 $this->entityType = $entity_type;
35 public function getDefinitions() {
36 $definition = \Drupal::entityTypeManager()->getDefinition($this->entityType);
37 $prefix = $definition->getConfigPrefix() . '.';
38 $storage = \Drupal::service('config.storage');
39 $query = \Drupal::entityQuery($this->entityType);
40 $ids = $query->execute();
42 foreach ($ids as $id) {
43 $definitions[$id] = $storage->read($prefix . $id);