Skip to content

Commit

Permalink
ACMS-3658: Generate settings only if its a drupal project.
Browse files Browse the repository at this point in the history
  • Loading branch information
chandan-singh7929 committed Mar 15, 2024
1 parent 271469e commit 3442add
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public function onPostPackageEvent(PackageEvent $event): void {
*/
public function onPostCmdEvent(): void {
// Only install the template files, if the drupal-recommended-settings
// plugin is installed.
if ($this->settingsPackage) {
// plugin is installed, with drupal project.
if ($this->settingsPackage && $this->getDrupalRoot()) {
try {
$vendor_dir = $this->composer->getConfig()->get('vendor-dir');
HashGenerator::generate($this->getProjectRoot(), $this->io);
Expand Down Expand Up @@ -148,7 +148,10 @@ protected function getProjectRoot(): string {
protected function getDrupalRoot(): string {
$extra = $this->composer->getPackage()->getExtra();
$docroot = $extra['drupal-scaffold']['locations']['web-root'] ?? "";
return realpath($this->getProjectRoot() . "/" . $docroot);
if ($docroot) {
return realpath($this->getProjectRoot() . "/" . $docroot);
}
return "";
}

/**
Expand Down

0 comments on commit 3442add

Please sign in to comment.