Reputation: 79
)
I've been trying to get my plugin to work for a week now. I stuck to the official documentation and looked here and there on YouTube. The plugin can be installed without any problems and I can also see my view in the storefront.
So far so good it went, the more I fail to get the plugin to work in the admin area. I've already looked over it with a programmer friend of mine and unfortunately he was also at a loss.
The index.js that should actually create the menu entry. Which unfortunately she doesn't:
import './view/swag-basic-list';
const { Module } = Shopware;
Module.register('swag-example', {
type: 'plugin',
name: 'Example',
color: '#ffff00',
icon: 'default-shopping-paper-bag-product',
title: 'hallo 123',
description: 'hallo 123 desc',
routes: {
list: {
path: 'list',
component: 'swag-example-list'
}
},
navigation: [{
id: 'swag-example-list',
label: 'CustomModule',
path: 'swag.example.list',
icon: 'default-shopping-paper-bag-product',
parent: 'sw-marketing',
position: 100
}]
});
The index.js to register the module:
import template from './swag-index.html.twig'
const {Component} = Shopware;
Component.register('swag-basic-list', {
template,
data() {
return {
'Hallo':'test',
}
}
});
The main.js:
import './module/swag-example';
import './module/swag-example/view/swag-basic-list';
My Folder tree: enter image description here
Actually I should be able to call the module under url/admin#/swag/example/list with the configuration and a menu entry should be created. But the URL itself just produces a white page and the menu item just isn't there.
Unfortunately, I'm also quite new to Shopware and don't have all the debugging methods on it yet, if there are any tips I'm happy to listen and otherwise I'd like to thank you for the help. <3
Upvotes: 1
Views: 536
Reputation: 79
Glad to hear that at least I'm not too stupid. :-D
Yes, I always re-built it in between. But actually the section in the documentary gave me an idea of what it could be. Unfortunately I have to wait until Monday to test it.
Thank you very much and I will report to you on Monday. :-)
Have a nice weekend.
Upvotes: 0
Reputation: 13161
I copied your code 1:1 and it worked right away (minus the template you omitted).
Did you re-build the administration after you installed and activated your plugin? The administration, including all plugins that extend the administration, has to be compiled after every change. Simply creating and editing the source files isn't enough. The build process will create a directory src/Resources/public/administration
within your plugin folder and put all the compiled JavaScript in there. It will be those scripts that are actually used in the administration.
Please see the section on how to build the administration in the documentation.
Upvotes: 2