protected function ConfigSource::getMapperId

Gets the mapper ID.

Parameters

\Drupal\tmgmt\JobItemInterface $job_item: The job item.

Return value

string The mapper ID to be used for the config mapper manager.

2 calls to ConfigSource::getMapperId()
ConfigSource::getMapper in sources/tmgmt_config/src/Plugin/tmgmt/Source/ConfigSource.php
Gets the mapper.
ConfigSource::getType in sources/tmgmt_config/src/Plugin/tmgmt/Source/ConfigSource.php
Returns the type of a job item.

File

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

Class

ConfigSource
Content entity source plugin controller.

Namespace

Drupal\tmgmt_config\Plugin\tmgmt\Source

Code

protected function getMapperId(JobItemInterface $job_item) {

  // @todo: Inject dependencies.
  if ($job_item
    ->getItemType() == static::SIMPLE_CONFIG) {
    return $job_item
      ->getItemId();
  }
  else {
    $mapper_id = $job_item
      ->getItemType();
    if ($mapper_id == 'field_config') {

      // Field configs are exposed as a different type for each entity type
      // to the config mapper manager.
      // @todo Consider doing the same for item types, would result in more
      //   item types.
      $id_parts = explode('.', $job_item
        ->getItemId());
      $mapper_id = $id_parts[2] . '_fields';
    }
    return $mapper_id;
  }
}