Plugin Entwicklung Backend Menüpunkt erscheint nicht

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
    {
    }
}

Vielleicht noch ein Hinweis, ist mir gerade aufgefallen. Nach dem kompilieren der Administration sollten doch innerhalb des Plugins unter resources/public/administration/ dateien erzeugt werden oder? Denn das ist bei mir nicht der Fall.

Wenn ich ./bin/build-administration.sh ausführe erhalte ich folgende Rückmeldung, ist das richtig?

CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"

export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}

# shellcheck source=functions.sh
source "${PROJECT_ROOT}/bin/functions.sh"

curenv=$(declare -p -x)

load_dotenv "$ENV_FILE"

# Restore environment variables set globally
set -o allexport
eval "$curenv"
set +o allexport

set -euo pipefail

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export DISABLE_ADMIN_COMPILATION_TYPECHECK=true
export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
ADMIN_ROOT="${ADMIN_ROOT:-"${PROJECT_ROOT}/vendor/shopware/administration"}"

BIN_TOOL="${CWD}/console"

if [[ ${CI-""} ]]; then
    BIN_TOOL="${CWD}/ci"

    if [[ ! -x "$BIN_TOOL" ]]; then
        chmod +x "$BIN_TOOL"
    fi
fi

# build admin
[[ ${SHOPWARE_SKIP_BUNDLE_DUMP-""} ]] || "${BIN_TOOL}" bundle:dump
"${BIN_TOOL}" feature:dump || true

if [[ $(command -v jq) ]]; then
    OLDPWD=$(pwd)
    cd "$PROJECT_ROOT" || exit

    jq -c '.[]' "var/plugins.json" | while read -r config; do
        srcPath=$(echo "$config" | jq -r '(.basePath + .administration.path)')

        # the package.json files are always one upper
        path=$(dirname "$srcPath")
        name=$(echo "$config" | jq -r '.technicalName' )

        skippingEnvVarName="SKIP_$(echo "$name" | sed -e 's/\([a-z]\)/\U\1/g' -e 's/-/_/g')"

        if [[ ${!skippingEnvVarName-""} ]]; then
            continue
        fi

        if [[ -f "$path/package.json" && ! -d "$path/node_modules" && $name != "administration" ]]; then
            echo "=> Installing npm dependencies for ${name}"

            npm install --prefix "$path" --no-audit --prefer-offline
        fi
    done
    cd "$OLDPWD" || exit
else
    echo "Cannot check extensions for required npm installations as jq is not installed"
fi

(cd "${ADMIN_ROOT}"/Resources/app/administration && npm install --no-audit --prefer-offline)

# Dump entity schema
if [[ -z "${SHOPWARE_SKIP_ENTITY_SCHEMA_DUMP-""}" ]] && [[ -f "${ADMIN_ROOT}"/Resources/app/administration/scripts/entitySchemaConverter/entity-schema-converter.ts ]]; then
  mkdir -p "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_
  "${BIN_TOOL}" -e prod framework:schema -s 'entity-schema' "${ADMIN_ROOT}"/Resources/app/administration/test/_mocks_/entity-schema.json
  (cd "${ADMIN_ROOT}"/Resources/app/administration && npm run convert-entity-schema)
fi

(cd "${ADMIN_ROOT}"/Resources/app/administration && npm run build)
[[ ${SHOPWARE_SKIP_ASSET_COPY-""} ]] ||"${BIN_TOOL}" assets:install