Hallo zusammen,
ich verzweifle gerade etwas. Versuche mich das erste mal an einem SW6 Plugin, um mir ein eigenes einfaches Blog Plugin zu schreiben. Gerade hänge ich schon daran, dass der Backend Menüpunkt nicht im Backend erscheinen will…
Ich hab ein Skeleton erstellt, folgende Dateien hinzugefügt und das Plugin fehlerfrei aktiviert.
Habe auch:
- php ./bin/build-administration.sh
- php bin/console bundle:dump
- php bin/console cache:clear
durhgeführt.
Kann mir jemand helfen? Im folgenden der Code
custom/plugins/RjBloggingSys/src/Resources/app/administration/src/module/my-blog-module/index.js
import './component/my-blog-module-list';
Shopware.Module.register('my-blog-module', {
type: 'plugin',
name: 'MyBlogModule',
title: 'my-blog-module.general.mainMenuItemGeneral',
description: 'My Blog Module',
color: '#ff3d58',
icon: 'default-object-lab-flask',
routes: {
index: {
component: 'my-blog-module-list',
path: 'index'
}
},
navigation: {
label: 'my-blog-module.general.mainMenuItemGeneral',
parent: 'sw-content',
position: 100
}
});
/custom/plugins/RjBloggingSys/src/Resources/app/administration/src/main.js
import './module/my-blog-module';
Shopware.Module.register('my-blog-module', {
type: 'plugin',
name: 'Blog',
title: 'my-blog-module.general.mainMenuItemGeneral',
description: 'My Blog Module',
color: '#ff3d58',
icon: 'default-object-lab-flask',
routes: {
index: {
component: 'my-blog-module-list',
path: 'index'
}
},
navigation: [{
label: 'my-blog-module.general.mainMenuItemGeneral',
color: '#ff3d58',
path: 'my.blog.module.index',
icon: 'default-object-lab-flask',
parent: 'sw-content',
position: 100
}]
});
/custom/plugins/RjBloggingSys/src/RjBloggingSys.php
<?php declare(strict_types=1);
namespace BloggingSystem;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
class RjBloggingSys extends Plugin
{
public function install(InstallContext $installContext): void
{
// Do stuff such as creating a new payment method
}
public function uninstall(UninstallContext $uninstallContext): void
{
parent::uninstall($uninstallContext);
if ($uninstallContext->keepUserData()) {
return;
}
// Remove or deactivate the data created by the plugin
}
public function activate(ActivateContext $activateContext): void
{
// Activate entities, such as a new payment method
// Or create new entities here, because now your plugin is installed and active for sure
}
public function deactivate(DeactivateContext $deactivateContext): void
{
// Deactivate entities, such as a new payment method
// Or remove previously created entities
}
public function update(UpdateContext $updateContext): void
{
// Update necessary stuff, mostly non-database related
}
public function postInstall(InstallContext $installContext): void
{
}
public function postUpdate(UpdateContext $updateContext): void
{
}
}