基本環境
EC-CUBE4.2.3
ページの設定
管理画面のどこに新ページを挿入するか決める
ホーム > 新ページ
商品管理 > 新ページ
受注管理 > 新ページ
会員管理 > 新ページ
コンテンツ管理 > 新ページ
設定 > 新ページ
設定 > 店舗設定 > 新ページ
設定 > システム設定 > 新ページ
オーナーズストア > 新ページ
オーナーズストア >プラグイン > 新ページ
オーナーズストア > テンプレート > 新ページ
twigページ作成
新ページ挿入場所によって置き場所が決まる
root/app/Plugin/Resource/template~
ホーム > 新ページ
~admin/hoge01.twig
商品管理 > 新ページ
~admin/Product/hoge01.twig
受注管理 > 新ページ
~admin/Order/hoge01.twig
会員管理 > 新ページ
~admin/Customer/hoge01.twig
コンテンツ管理 > 新ページ
~admin/Content/hoge01.twig
設定 > 新ページ
~admin/Setting/hoge01.twig
設定 > 店舗設定 > 新ページ
~admin/Setting/Shop/hoge01.twig
設定 > システム設定 > 新ページ
~admin/Setting/System/hoge01.twig
オーナーズストア > 新ページ
~admin/Store/hoge01.twig
オーナーズストア >プラグイン > 新ページ
~admin/Store/hoge01.twig
オーナーズストア > テンプレート > 新ページ
~admin/Store/hoge01.twig
なぜかオーナーズストア直下はディレクトリ分けされていない
例)
~admin/Setting/hoge01.twig
設定 > 店舗設定 > 新ページ
hoge.twig に以下を記載
{% set menus = ['setting', 'shop', 'hoge01'] %}
{% block title %}{{ 'admin.setting.shop.hoge.title'|trans}}{% endblock %}
{% block sub_title %}{{ 'admin.setting.shop.hoge.subtitle'|trans }}{% endblock %}
{% block main %}
admin.setting.shop.hoge.title: タイトルホゲ01
admin.setting.shop.hoge.subtitle: サブタイトルホゲ01
Nav.php 作成
新規ページが1ページの場合
<?php
namespace Plugin\PluginName;
use Eccube\Common\EccubeNav;
class Nav implements EccubeNav
{
/**
* {@inheritdoc}
*
* @return array
*/
public static function getNav()
{
return [
'setting' => [
'children' => [
'shop' => [
'children' => [
'shop_hoge01' => [
'name' => 'タイトルホゲ01',
'url' => 'hoge01',
],
],
],
],
],
];
}
}
新規ページが複数の場合
<?php
namespace Plugin\PluginName;
use Eccube\Common\EccubeNav;
class Nav implements EccubeNav
{
/**
* {@inheritdoc}
*
* @return array
*/
public static function getNav()
{
return [
'setting' => [
'children' => [
'shop' => [
'children' => [
'shop_country_setting' => [
'name' => 'ページタイトル01',
'url' => 'hoge01',
],
'shop_mail_setting' => [
'name' => 'ページタイトル02',
'url' => 'hoge02',
],
],
],
],
],
];
}
}
Controller 作成
<?php
namespace Plugin\PluginName\Controller\Admin;
use Eccube\Controller\AbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class PluginNameController extends AbstractController
{
/**
* @Route("/%eccube_admin_route%/setting/shop/hoge01", name="hoge01")
* @Template("@PluginName/admin/Setting/Shop/hoge01.twig")
*/
public function hoge01(Request $request)
{
}
/**
* @Route("/%eccube_admin_route%/setting/shop/hoge02", name="hoge02")
* @Template("@PluginName/admin/Setting/Shop/hoge02.twig")
*/
public function hoge02(Request $request)
{
}
}