forumone / gesso

Gesso Drupal theme
66 stars 13 forks source link

ThemeHandlerInterface does not have a getPath() method #876

Closed johnbburg closed 1 week ago

johnbburg commented 1 week ago

I am getting this error when I try to run ddev gesso install

Error: Call to undefined method Drupal\Core\Extension\ThemeHandler::getPath() in 
/var/www/html/web/themes/gesso/gesso_helper/src/Commands/GessoHelperCommands.php 
on line 116 #0 [internal function]: Drupal\gesso_helper\Commands\GessoHelperCommands->gesso('install', Array)

GessoHelperCommands::gesso() line 116 calls this:

    $gesso_path = Path::join($drupalRoot, $this->themeHandler->getPath('gesso'));

$this->themeHandler is an instance of ThemeHandlerInterface, but according to the API for that, getPath is not a method.

I think the intention was likely to get the theme from that class, and then get the path like this:

$this->themeHandler->getTheme('gesso')->getPath()

But I'm not sure if there is some complicating factor here causing me to run into this, since this seems like it would have come up sooner.

johnbburg commented 1 week ago

Follow up, fixing that in my local, I then get this:

TypeError: Symfony\Component\Filesystem\Filesystem::mirror(): Argument #4 ($options) must be of type array, int given,
 called in /var/www/html/web/themes/gesso/gesso_helper/src/Commands/GessoHelperCommands.php 
on line 122 in /var/www/html/vendor/symfony/filesystem/Filesystem.php 
on line 536 #0 /var/www/html/web/themes/gesso/gesso_helper/src/Commands/GessoHelperCommands.php(122): Symfony\Component\Filesystem\Filesystem->mirror('/var/www/html/w...', '/var/www/html/w...', Object(RecursiveIteratorIterator), 1)
#1 [internal function]: Drupal\gesso_helper\Commands\GessoHelperCommands->gesso('install', Array)

It's difficult to tell what the original intention was here. The Symfony Filesystem class expects an associative array of options here. Perhaps it was supposed to be:

[
    'override' =>  true
]
kmonahan commented 1 week ago

@johnbburg You're getting this from ddev gesso install, not ddev drush gesso? ddev gesso install shouldn't be calling Gesso Helper at all -- it should be running npm ci on the gesso container so even odder that you're getting these errors. Is there a specific project you're seeing this on or is it across all projects?

The ddev drush gesso command is for creating a new copy of the theme named something other than Gesso. It's not used too often and it's been a bit since I've looked at it, so it's entirely possible that it needs updates for the current versions of Drupal and Drush.

johnbburg commented 1 week ago

Ok, not sure why I was trying to run ddev drush gesso, that might have been a blank moment on my part, or the result of working a late evening. Nevermind I guess? ddev gesso install works fine.

kmonahan commented 1 week ago

👍 I'm going to leave this issue open since it sounds like we do have some issues with ddev drush gesso to look into

coreylafferty commented 1 week ago

Closing. Duplicate of https://github.com/forumone/gesso/issues/872