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

プラグインのテンプレートを上書きできるように対応 #4527

Merged
merged 3 commits into from
Jun 26, 2020

Conversation

chihiro-adachi
Copy link
Contributor

@chihiro-adachi chihiro-adachi commented Apr 27, 2020

概要(Overview・Refs Issue)

#4521 の対応

方針(Policy)

app/template/plugin/[Plugin Code]以下にテンプレートが配置されている場合に、プラグインのテンプレートより優先して読み込むように対応

実装に関する補足(Appendix)

以下のようなプラグインの場合、

[app/Plugin/Sample]
│ 
├── Controller
│   └── Admin
│       └── ConfigController.php
├── Resource
│   └── template
│       └── admin
│           └── config.twig
class ConfigController extends AbstractController
{
    /**
     * @Route("/%eccube_admin_route%/sample/config", name="sample_admin_config")
     * @Template("@Sample/admin/config.twig")
     */
    public function index(Request $request)

app/template/plugin/Sample/admin/config.twig に配置することで、こちらを優先して読み込まれます。

[app/template]
│
├── admin
├── default
├── plugin
│   └── Sample
│       └── admin
│           └── config.twig
└── user_data

ディレクトリの新規作成時は、キャッシュのクリアが必要です。

テスト(Test)

  • ファイルを設置し、上書きされていることを確認
  • E2Eテストを作成

相談(Discussion)

マイナーバージョン互換性保持のための制限事項チェックリスト

  • 既存機能の仕様変更
  • フックポイントの呼び出しタイミングの変更
  • フックポイントのパラメータの削除・データ型の変更
  • twigファイルに渡しているパラメータの削除・データ型の変更
  • Serviceクラスの公開関数の、引数の削除・データ型の変更
  • 入出力ファイル(CSVなど)のフォーマット変更

レビュワー確認項目

  • 動作確認
  • コードレビュー
  • E2E/Unit テスト確認(テストの追加・変更が必要かどうか)
  • 互換性が保持されているか
  • セキュリティ上の問題がないか

@chihiro-adachi chihiro-adachi added the enhancement 機能追加 label Apr 27, 2020
@chihiro-adachi chihiro-adachi added this to the 4.0.4 milestone Apr 27, 2020
@chihiro-adachi chihiro-adachi changed the title #4521 プラグインのテンプレートを上書きできるように対応 プラグインのテンプレートを上書きできるように対応 Apr 27, 2020
@chihiro-adachi chihiro-adachi changed the title プラグインのテンプレートを上書きできるように対応 [WIP] プラグインのテンプレートを上書きできるように対応 Apr 27, 2020
@chihiro-adachi chihiro-adachi force-pushed the improve-template branch 2 times, most recently from 6bc9224 to d6641a8 Compare May 1, 2020 05:55
@chihiro-adachi chihiro-adachi changed the title [WIP] プラグインのテンプレートを上書きできるように対応 プラグインのテンプレートを上書きできるように対応 May 1, 2020
@okazy
Copy link
Contributor

okazy commented May 1, 2020

クーポンプラグインでプラグインのテンプレートを上書きできるプルリクをいただいていました。
EC-CUBE/coupon-plugin#126

本プルリクとリンク先のプルリクでテンプレートの配置構造が異なっています。
既存のプラグインへの影響を含めて確認が必要かと思いました。

Copy link
Contributor

@okazy okazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます。問題ないと思います。

@okazy okazy added Status: ready-for-merge document Improvements or additions to documentation labels Jun 25, 2020
@okazy okazy merged commit 0f48771 into EC-CUBE:4.0 Jun 26, 2020
@okazy
Copy link
Contributor

okazy commented Jun 26, 2020

ありがとうございます。マージしました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected:plugin プラグインに影響する可能性のある実装変更 document Improvements or additions to documentation enhancement 機能追加 Status: ready-for-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants