nystudio107 / generator-craftplugin

generator-craftplugin is a Yeoman generator for Craft CMS plugins
MIT License
74 stars 30 forks source link

widget iconPath() incorrect (craft3 module) #54

Closed anchovy closed 4 years ago

anchovy commented 6 years ago

HI

Craft CMS 3.0.3.1 (PRO)

When creating a Craft 3 module with widgets - the iconPath in the widget is missing the prefix 'modules', as the alias is set in /modules/{module_name/src/{module_name}.php __construct() as:

Craft::setAlias('@modules/restmodule', $this->getBasePath());

The function iconPath() /modules/{module_name}/src/widgets/{widget_name).php is: return Craft::getAlias("@{module_name}/assetbundles/fibrewidget/dist/img/{widget_name}-icon.svg");

when it should be: return Craft::getAlias("@modules/{module_name}/assetbundles/fibrewidget/dist/img/{widget_name}-icon.svg");

khalwat commented 6 years ago

Thanks, I'll get this fixed up.

MattWilcox commented 5 years ago

Same error here in October, but a simple fix - thanks both!

bymayo commented 5 years ago

As well as fixing it in /modules/{module_name}/src/{module_name}.php I also had to change iconUrl variable in /modules/{module_name}/src/templates/_components/widgets/{module_name}_body.php from @{module_name} to @modules/{module_name}

TomDeSmet commented 5 years ago

Just had this same issue. Would be nice if this could be fixed in the pluginfactory :) Thanks for the solution guys!

khalwat commented 4 years ago

Fixed in https://github.com/nystudio107/generator-craftplugin/commit/00702811417fa47b7866858ed634480676dd0272