You are here

protected function ConfigDevelCommands::getExtensionType in Configuration development 8

Returns the type for the given extension.

Parameters

string $extension: The extension name.

Return value

string Either 'module', 'theme', 'profile', or NULL if no valid extension was provided.

2 calls to ConfigDevelCommands::getExtensionType()
ConfigDevelCommands::export in src/Commands/ConfigDevelCommands.php
Write back configuration to module's config directory.
ConfigDevelCommands::import in src/Commands/ConfigDevelCommands.php
Import configuration from module's config directory to active storage.

File

src/Commands/ConfigDevelCommands.php, line 260

Class

ConfigDevelCommands
Drush integration for the Configuration Development module.

Namespace

Drupal\config_devel\Commands

Code

protected function getExtensionType($extension) {
  $type = NULL;

  // Check the profile first, as profiles are treated as modules by
  // moduleExists()!
  if (\Drupal::installProfile() === $extension) {
    $type = 'profile';
  }
  elseif ($this->moduleHandler
    ->moduleExists($extension)) {
    $type = 'module';
  }
  elseif ($this->themeHandler
    ->themeExists($extension)) {
    $type = 'theme';
  }
  return $type;
}