Skip to content

Commit 501ff65

Browse files
authored
Fix constant definition (#160)
* [console] Remove constants.php file. * [console] Extend DrupalFinder class. * [console] Fix docblock.
1 parent 64c4f8d commit 501ff65

File tree

3 files changed

+47
-7
lines changed

3 files changed

+47
-7
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"prefer-stable": true,
5858
"autoload": {
5959
"files": [
60-
"src/constants.php",
6160
"src/functions.php"
6261
],
6362
"psr-4": {"Drupal\\Console\\Core\\": "src"}

src/Utils/DrupalFinder.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Contains Drupal\Console\Core\Utils\DrupalFinder.
6+
*/
7+
8+
namespace Drupal\Console\Core\Utils;
9+
10+
use DrupalFinder\DrupalFinder as DrupalFinderBase;
11+
12+
/**
13+
* Class DrupalFinder
14+
*
15+
* @package Drupal\Console\Core\Utils
16+
*/
17+
class DrupalFinder extends DrupalFinderBase
18+
{
19+
public function locateRoot($start_path)
20+
{
21+
if (parent::locateRoot($start_path)) {
22+
$composerRoot = $this->getComposerRoot();
23+
$vendorDir = str_replace(
24+
$composerRoot .'/', '', $this->getVendorDir()
25+
);
26+
if (!defined("DRUPAL_CONSOLE_CORE")) {
27+
define(
28+
"DRUPAL_CONSOLE_CORE",
29+
"/{$vendorDir}/drupal/console-core/"
30+
);
31+
}
32+
if (!defined("DRUPAL_CONSOLE")) {
33+
define("DRUPAL_CONSOLE", "/{$vendorDir}/drupal/console/");
34+
}
35+
if (!defined("DRUPAL_CONSOLE_LANGUAGE")) {
36+
define(
37+
"DRUPAL_CONSOLE_LANGUAGE",
38+
"/{$vendorDir}/drupal/console-%s/translations/"
39+
);
40+
}
41+
42+
return true;
43+
}
44+
45+
return false;
46+
}
47+
}

src/constants.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)