0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

EC-CUBE4独自プラグインサンプル作り方

Last updated at Posted at 2022-03-24

作業環境

EC-CUBE4.0.5

プラグインジェネレータを生成

EC-CUBEサイトroot

cd /var/www/html/example.com
php bin/console eccube:plugin:generate

対話形式

EC-CUBE Plugin Generator Interactive Wizard
===========================================

 name [EC-CUBE Sample Plugin]:
 > 

と聞かれるのでプラグイン名を入力

 name [EC-CUBE Sample Plugin]:
 > EC-CUBE4 ホゲカスタマイズプラグイン

コード名を入力

 code [Sample]:
 > HogeCustom

すでに同名プラグインが存在する場合はエラー

 [ERROR] Plugin directory exists.                                                     

別のコード名を入力

 code [Sample]:
 > HogeSpecialCustom

バージョンを入力

 ver [1.0.0]:
 > 

提案されたバージョンでよければ無入力でEnter

[OK] Plugin was successfully created: EC-CUBE4 ホゲカスタマイズプラグイン HogeSpecialCustom 1.0.0 

プラグインサンプル生成に成功

確認する

ls /var/www/html/example.com/app/Plugin/

HogeSpecialCustom

インストール

php bin/console eccube:plugin:install --code=HogeSpecialCustom

 [OK] Installed.  

[OK] Installed. と緑帯の中に表示されればインストール成功
管理画面 > オーナーズストア >プラグイン一覧 > ユーザー独自プラグインで存在を確認

有効化

php bin/console eccube:plugin:enable --code=HogeSpecialCustom

ディレクトリ構造

以下のディレクトリとファイルが生成されている

├── composer.json
├── Controller
│   └── Admin
│       └── ConfigController.php
├── Entity
│   └── Config.php
├── Event.php
├── Form
│   ├── Extension
│   └── Type
│       └── Admin
│           └── ConfigType.php
├── Navi.php
├── Repository
│   └── ConfigRepository.php
├── Resource
│   └── doctrine
│       ├── messages.ja.yaml
│       └── validators.ja.yaml
│   └── template
│       └── admin
│           └── config.twig
└── TwigBlock.php

プラグインパッケージ化

プラグインルートに移動

$ COPYFILE_DISABLE=1 tar --exclude ".git" --exclude ".DS_Store" -cvzf ../[PluginDir].tar.gz *でパッケージ化

cd app/Plugin/[PluginDir]
$ COPYFILE_DISABLE=1 tar --exclude  ".git" --exclude ".DS_Store" -cvzf ../[PluginDir].tar.gz *

参考記事

https://www.u2yasan.com/ja/content/20200624/89

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?