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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
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
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
170
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
610
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.6k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
640
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
800
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
130
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
990
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.6k
スマートグラスで並列バイブコーディング
hyshu
0
270
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
610
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.8k
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
210
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
330
40k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
360
Skip the Path - Find Your Career Trail
mkilby
1
160
The browser strikes back
jonoalderson
0
1.3k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Into the Great Unknown - MozCon
thekraken
41
2.6k
Abbi's Birthday
coloredviolet
3
8.3k
Ethics towards AI in product and experience design
skipperchong
2
320
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