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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
480
EC-CUBE 3.0勉強会
amidaike
1
980
EC-CUBE3デザイナー向け勉強会 #4
amidaike
0
320
EC-CUBE3コードリーディング #5
amidaike
1
1.5k
EC-CUBE3デザイナー向け勉強会 #1
amidaike
0
300
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
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
JJUG CCC 2026 Spring: JSpecify で実現する Kotlin フレンドリーな Java API 設計
ternbusty
1
140
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
240
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
380
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
300
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
160
AI時代のUIはどこへ行く?その2!
yusukebe
19
6.7k
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.3k
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
620
今さら聞けないCancellationToken
htkym
0
220
Agentic UI
manfredsteyer
PRO
0
110
CSC307 Lecture 17
javiergs
PRO
0
320
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Un-Boring Meetings
codingconduct
0
310
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
For a Future-Friendly Web
brad_frost
183
10k
How to make the Groovebox
asonas
2
2.2k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
220
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
We Are The Robots
honzajavorek
0
240
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
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