Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with crating a vizy module #269

Open
anchovy opened this issue Nov 29, 2023 · 3 comments
Open

Help with crating a vizy module #269

anchovy opened this issue Nov 29, 2023 · 3 comments

Comments

@anchovy
Copy link

anchovy commented Nov 29, 2023

Question

We've followed the documentation on https://verbb.io/craft-plugins/vizy/user-guides/creating-a-custom-node-from-scratch to create a new module.

We had to add use Craft; to fix the Class "modules\vizymodule\Craft" not found error thrown by the line Craft::setAlias('@vizy-module', __DIR__);

The pulgin works as expected until we try and run any craft command line commands, then we get the error:

./craft
Exception 'yii\base\InvalidArgumentException' with message 'Invalid path alias: @modules/vizymodule/controllers'

Any ideas how to get around this?
I've tried adding a default controller in /controllers/DefaultController.php but this doesn't fix the issue.

Additional context

Craft edition & version | Craft Pro 4.5.9
Vizy | 2.1.12

@engram-design
Copy link
Member

Just fixed up that missing Craft reference. And it depends on how your module is setup, there's lots of bootstrapping to do to get various things working like controllers which is why it might be useful to extend our base module as a starting point. Or, you can copy-paste from the previous link.

@anchovy
Copy link
Author

anchovy commented Nov 29, 2023

Thanks for that @engram-design

I change the module to use Craft::setAlias('@modules/vizymodule', __DIR__); and in the Asset Bundle class to use $this->sourcePath = '@modules/vizymodule/assets'; and this seems to have cleared up the error running console comands.

@engram-design
Copy link
Member

I’ll double check that, but you shouldn’t need to use @modules/vizymodule but glad that’s working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants