Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
EC-CUBE3プラグイン勉強会
Search
amidaike
April 27, 2016
Programming
480
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
EC-CUBE3プラグイン勉強会
amidaike
April 27, 2016
More Decks by amidaike
See All by amidaike
EC-CUBE3勉強会新しいデザインを作成してみよう
amidaike
0
490
EC-CUBE 3.0勉強会
amidaike
1
990
EC-CUBE3デザイナー向け勉強会 #4
amidaike
0
330
EC-CUBE3コードリーディング #5
amidaike
1
1.5k
EC-CUBE3デザイナー向け勉強会 #1
amidaike
0
310
EC-CUBE3デザイナー向け勉強会 #3
amidaike
1
230
EC-CUBE3コードリーディング #4
amidaike
0
1.3k
EC-CUBE3デザイナー向け勉強会 #2
amidaike
1
2.8k
EC-CUBE3コードリーディング #3
amidaike
1
970
Other Decks in Programming
See All in Programming
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
120
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
480
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
240
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
360
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
210
act1-costs.pdf
sumedhbala
0
170
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
190
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
170
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
290
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.3k
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
7
2.2k
1B+ /day規模のログを管理する技術
broadleaf
0
130
Featured
See All Featured
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
410
Practical Orchestrator
shlominoach
191
11k
Embracing the Ebb and Flow
colly
88
5.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
エンジニアに許された特別な時間の終わり
watany
107
250k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
460
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
240
Paper Plane
katiecoart
PRO
1
52k
Agile that works and the tools we love
rasmusluckow
331
22k
How to train your dragon (web standard)
notwaldorf
97
6.7k
Everyday Curiosity
cassininazir
0
250
30 Presentation Tips
portentint
PRO
1
340
Transcript
EC-CUBE3ϓϥάΠϯษڧձ EC-CUBEؔϢʔβάϧʔϓ 2016-04-27
࣍ 1. ϓϥάΠϯͷ֓ཁ 2. ϓϥάΠϯͷ࡞खॱ 3. ϓϥάΠϯࢀߟ
1.ϓϥάΠϯͷ֓ཁ
ϓϥάΠϯͷ֓ཁ • EC-CUBE3.0.9͔ΒϓϥάΠϯػߏ͕มߋ͞Ε·ͨ͠ɻ ओͳมߋϓϥάΠϯ༷ॻΛ֬ೝ͍ͯͩ͘͠͞ɻ • ޙํޓੑ͍ͯ͠·͕͢ɺࠓճ৽͘͠ͳͬͨϓ ϥάΠϯػߏΛݩʹઆ໌Λߦ͍·͢ɻ
2.ϓϥάΠϯͷ࡞खॱ
ϓϥάΠϯͷ࡞खॱ • ࠓճͷαϯϓϧͰ؆қϥοϐϯάରԠදࣔϓϥάΠϯͱ͍͏ ϓϥάΠϯΛݩʹઆ໌͠·͢ɻ https://github.com/k-yamamura/eccube3-new-sample-plugin • ͜ͷϓϥάΠϯͷ༰ͱͯ͠ɺ ʮߪೖ࣌ʹϥοϐϯάͷ༗ແΛબՄೳʯ ʮϓϥάΠϯઃఆը໘ͰϥοϐϯάදࣔՄ൱Λઃఆʯ ͱ͍͏ಈ࡞Λ͠·͢ɻ
ϓϥάΠϯͷ࡞खॱ • ϓϥάΠϯͷ࡞खॱͱͯ͠ɺओʹҎԼͱͳΓ·͢ɻ 1. ϓϥάΠϯ༻σΟϨΫτϦͷ࡞ 2. config.ymlͷ࡞ 3. event.ymlͷ࡞ 4.
PluginManagerΫϥεͷ࡞ 5. EventΫϥεͷ࡞ 6. ServiceProviderΫϥεͷ࡞ 7. consoleίϚϯυΛར༻ͨ͠ϓϥάΠϯ։ൃ
ϓϥάΠϯͷ࡞खॱ • ϓϥάΠϯ༻σΟϨΫτϦ࡞ ECCUBEROOT/app/PluginσΟϨΫτϦԼʹϓϥά Πϯ༻ͷσΟϨΫτϦΛ࡞͠·͢ɻ ECCUBEROOT/app/Plugin/Xxxx !Xxxxconfig.ymlʹهड़͢Δcodeͱ߹Θ ͤΔඞཁ͕͋Γɺ1จࣈඞͣӳ֯େจࣈ ʹ͢Δඞཁ͕͋Γ·͢ɻ
ϓϥάΠϯͷ࡞खॱ • config.ymlͷ࡞ ϓϥάΠϯσΟϨΫτϦԼʹconfig.ymlΛ࡞͠· ͢ɻconstͱݺΕΔͱఆهड़Մೳ͕ͩɺϓϥάΠ ϯ͕ແޮͷ߹ɺ͜ͷఆಡΈࠐΊ·ͤΜɻ name: GiftWrappingϓϥάΠϯ ※ඞਢ code:
GiftWrapping ※ඞਢ version: 1.0.0 ※ඞਢ service: - GiftWrappingServiceProvider orm.path: - /Resource/doctrine ※ϓϥάΠϯͰՃͨ͠ςʔϒϧΛ࡞͢Δ߹ɺorm.pathͷهड़ඞਢ event: GiftWrappingEvent ※eventΛՃ͢Δ߹ɺeventͷهड़ඞਢ
ϓϥάΠϯͷ࡞खॱ • event.ymlͷ࡞ ΠϕϯτΛར༻͢Δ߹ɺevent.ymlΛ࡞͢Δඞཁ͕ ͋Γ·͢ɻ3.0.9͔Β৽ͨͳΠϕϯτ͕༻ҙ͞Ε͍ͯ· ͢ɻ front.shopping.index.initialize: - [onShoppingIndexInitialize, NORMAL]
Shopping/index.twig: - [onShoppingIndexRender, NORMAL]
ϓϥάΠϯͷ࡞खॱ • PluginManagerΫϥεͷ࡞ ϓϥάΠϯͷΠϯετʔϧ༗ޮɺແޮ࣌ͷઃఆΛߦ͏ PluginManager.phpϑΝΠϧΛ࡞͠·͢ɻͪ͜ΒͷΫ ϥεͰϓϥάΠϯ͕Πϯετʔϧ͞Εͨ࣌ͷॲཧɺ༗ ޮʹͳͬͨ࣌ɺແޮʹͳͬͨ࣌ͷॲཧΛهड़͠·͢ɻ
ϓϥάΠϯͷ࡞खॱ <?php namespace Plugin\GiftWrapping; use Eccube\Plugin\AbstractPluginManager; use Symfony\Component\Filesystem\Filesystem; class PluginManager
extends AbstractPluginManager { /** * @var string ίϐʔݩϦιʔεσΟϨΫτϦ */ private $origin; /** * @var string ίϐʔઌϦιʔεσΟϨΫτϦ */ private $target; public function __construct() { // ίϐʔݩͷσΟϨΫτϦ $this->origin = __DIR__.'/Resource/assets'; // ίϐʔઌͷσΟϨΫτϦ $this->target = '/giftwrapping'; } /** * ϓϥάΠϯΠϯετʔϧ࣌ͷॲཧ * * @param $config * @param $app * @throws \Exception */ public function install($config, $app) { // ϦιʔεϑΝΠϧͷίϐʔ $this->copyAssets($app); }
ϓϥάΠϯͷ࡞खॱ • EventΫϥεͷ࡞ event.ymlͰఆٛ͞Ε֤ͨΠϕϯτʹରԠ͢Δϝιου ΛEventΫϥεʹ࡞͠·͢ɻϓϥάΠϯ͕ೝࣝ͞ΕΔ ͱconfig.ymlʹevent͕ఆٛ͞Ε͍ͯΕɺ͜ͷEventΫ ϥεͰఆٛ͞Ε͍ͯΔؔͱevent.ymlͰఆٛͨ͠༰ ΛϚοϐϯάͯ͠EC-CUBE༻Πϕϯτ͕࣮ߦ͞ΕΔΑ ͏ʹͳΓ·͢ɻ
ϓϥάΠϯͷ࡞खॱ <?php namespace Plugin\GiftWrapping; use Eccube\Event\EventArgs; use Eccube\Event\TemplateEvent; class GiftWrappingEvent
{ /** @var \Eccube\Application $app */ private $app; public function __construct($app) { $this->app = $app; } public function onShoppingIndexInitialize(EventArgs $event) { // ϑΥʔϜͷՃ // FormBuilderͷऔಘ $builder = $event->getArgument('builder'); // ߲ͷՃ $builder->add('gift_wrapping', 'choice', array( 'choices' => array( '1' => 'ͷ͠ͷΑ͏ͳͷ', '2' => 'ϦϘϯ', '3' => 'ࢴแΈ', ), 'expanded' => false, 'multiple' => false, 'required' => false, 'empty_value' => 'ϥοϐϯάͳ͠', 'mapped' => false, )); } public function onShoppingIndexRender(TemplateEvent $event) {
ϓϥάΠϯͷ࡞खॱ • ServiceProviderΫϥεͷ࡞ ϓϥάΠϯσΟϨΫτϦԼʹServiceProviderσΟϨΫτ ϦΛ࡞͠ɺͦͷԼʹServiceProviderΫϥεΛ࡞͠ ·͢ɻ͜ͷΫϥεɺϧʔςΟϯάఆٛϑΝΠϧɺϓϥ άΠϯͰར༻͢ΔϦϙδτϦΫϥεͳͲΛఆٛ͢ΔͨΊʹ ༻ҙ͞Ε·͢ɻϓϥάΠϯ͕ೝࣝ͞ΕΔͱconfig.ymlʹ service͕ఆٛ͞Ε͍ͯΕɺServiceProviderΫϥεΛݩ ʹઃఆ͕ར༻͞ΕΔΑ͏ʹͳΓ·͢ɻ
ϓϥάΠϯͷ࡞खॱ <?php namespace Plugin\GiftWrapping\ServiceProvider; use Eccube\Application; ɾɾɾɾ ɾɾɾɾ class GiftWrappingServiceProvider
implements ServiceProviderInterface { public function register(BaseApplication $app) { // // ϝοηʔδొ $app['translator'] = $app->share($app->extend('translator', function ($translator, \Silex\Application $app) { $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader()); $file = __DIR__.'/../Resource/locale/message.'.$app['locale'].'.yml'; if (file_exists($file)) { $translator->addResource('yaml', $file, $app['locale']); } return $translator; })); // load config $conf = $app['config']; $app['config'] = $app->share(function () use ($conf) { $confarray = array(); $path_file = __DIR__.'/../Resource/config/path.yml'; if (file_exists($path_file)) { $config_yml = Yaml::parse(file_get_contents($path_file)); if (isset($config_yml)) { $confarray = array_replace_recursive($confarray, $config_yml); } } $constant_file = __DIR__.'/../Resource/config/constant.yml'; if (file_exists($constant_file)) { $config_yml = Yaml::parse(file_get_contents($constant_file)); if (isset($config_yml)) { $confarray = array_replace_recursive($confarray, $config_yml); }
ϓϥάΠϯͷ࡞खॱ • consoleίϚϯυΛར༻ͨ͠ϓϥάΠϯ։ൃ ϓϥάΠϯ։ൃ࣌ɺҰ୴ΞʔΧΠϒͨ͠ޙϓϥάΠϯͷΠϯετʔϧΛߦ͏ඞཁ ͕͋Γ·͕͢ɺEC-CUBE3.0.9͔ΒίϚϯυϕʔεͰ։ൃͷखॿ͚Λߦ͏खॱ͕ఏ ڙ͞Ε͍ͯ·͢ɻৄ͘͠ԼهURLΛࢀর͍ͯͩ͘͠͞ɻ http://ec-cube.github.io/plugin_console.html
php app/console plugin:develop install --code=Xxxx --codeύϥϝʔλʹར༻͍ͨ͠ϓϥάΠϯͷcodeΛઃఆͯ͘͠ ͍ͩ͞ɻࠓճͷྫͰPluginManagerΫϥεͷinstallϝιου ͕࣮ߦ͞Ε·͢ɻ
3.ϓϥάΠϯࢀߟ
։ൃ࣌ͷࢀߟϖʔδ • ϓϥάΠϯ༷ॻ http://downloads.ec-cube.net/src/manual/v3/plugin.pdf • ৽ϓϥάΠϯػߏͷઆ໌ http://qiita.com/chihiro-adachi/items/6318642120f67faedf0b • αϯϓϧϓϥάΠϯ https://github.com/k-yamamura/eccube3-new-sample-plugin
• ϓϥάΠϯδΣωϨʔλ http://www.ec-cube.net/products/detail.php?product_id=1022