You are here

protected function ComponentGenerateForm::getExistingModule in Module Builder 8.3

Returns the path to the module if it has previously been written.

Return value

A Drupal-relative path to the module folder, or NULL if the module does not already exist.

1 call to ComponentGenerateForm::getExistingModule()
ComponentGenerateForm::form in src/Form/ComponentGenerateForm.php
Gets the actual form array to be built.

File

src/Form/ComponentGenerateForm.php, line 164

Class

ComponentGenerateForm
Form showing generated component code.

Namespace

Drupal\module_builder\Form

Code

protected function getExistingModule() {
  $module_name = $this->entity
    ->id();
  $exists = \Drupal::service('extension.list.module')
    ->exists($module_name);
  if ($exists) {
    $module = \Drupal::service('extension.list.module')
      ->get($module_name);
    return $module
      ->getPath();
  }
}