@@ -24,41 +24,36 @@ public function getInstallPath(PackageInterface $package)
24
24
}
25
25
26
26
/**
27
- * Get the base path that the theme should be installed into.
28
- * Defaults to themes / and can be overridden in the root project 's composer.json.
27
+ * Get the base path that the module should be installed into.
28
+ * Defaults to Modules / and can be overridden in the module 's composer.json.
29
29
* @return string
30
30
*/
31
31
protected function getBaseInstallationPath ()
32
32
{
33
- if ($ this ->composer && $ this ->composer ->getPackage ()) {
34
- $ extra = $ this ->composer ->getPackage ()->getExtra ();
33
+ if (!$ this ->composer || !$ this ->composer ->getPackage ()) {
34
+ return 'themes ' ;
35
+ }
36
+
37
+ $ extra = $ this ->composer ->getPackage ()->getExtra ();
35
38
36
- if (array_key_exists ('theme-dir ' , $ extra )) {
37
- return $ extra ['theme-dir ' ];
38
- }
39
+ if (!$ extra || empty ($ extra ['theme-dir ' ])) {
40
+ return 'themes ' ;
39
41
}
40
42
41
- return ' themes ' ;
43
+ return $ extra [ ' theme-dir ' ] ;
42
44
}
43
45
44
46
/**
45
47
* Get the theme name
46
48
* "something" => "something"
47
49
* "vendor-name/something" => "something"
48
50
* "vendor-name/something-theme" => "something"
49
- *
50
51
* @param PackageInterface $package
51
- *
52
52
* @return string
53
+ * @throws \Exception
53
54
*/
54
55
protected function getThemeName (PackageInterface $ package )
55
56
{
56
- $ name = $ package ->getPrettyName ();
57
-
58
- if (($ pos = strpos ('/ ' , $ name )) !== false ) {
59
- $ name = substr ($ name , 0 , $ pos + 1 );
60
- }
61
-
62
57
return str_replace ('-theme ' , '' , str_replace ('theme- ' , '' , $ package ->getPrettyName ()));
63
58
}
64
59
}
0 commit comments