public function ConfigSource::getItemTypes

Returns an array of translatable source item types.

Overrides SourcePluginBase::getItemTypes

1 call to ConfigSource::getItemTypes()
ConfigSource::getItemTypeLabel in sources/tmgmt_config/src/Plugin/tmgmt/Source/ConfigSource.php
Returns the label of a source item type.

File

sources/tmgmt_config/src/Plugin/tmgmt/Source/ConfigSource.php, line 307

Class

ConfigSource
Content entity source plugin controller.

Namespace

Drupal\tmgmt_config\Plugin\tmgmt\Source

Code

public function getItemTypes() {

  // Only entity types are exposed as their own item type, all others are
  // grouped together in simple config.
  $entity_types = $this->entityTypeManager
    ->getDefinitions();
  $definitions = $this->configMapperManager
    ->getDefinitions();
  $types = array();
  foreach ($definitions as $definition_name => $definition) {
    if (isset($definition['entity_type'])) {
      $types[$definition['entity_type']] = (string) $entity_types[$definition['entity_type']]
        ->getLabel();
    }
  }
  $types[static::SIMPLE_CONFIG] = t('Simple configuration');
  return $types;
}