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
490
EC-CUBE 3.0勉強会
amidaike
1
1k
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
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
1k
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
260
GitHubCopilotCLIのスラッシュコマンドを自作してみる
htkym
0
100
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
1
240
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
190
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
360
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
420
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
150
광주소프트웨어마이스터고등학교 DevFest 특강 - 바이브 코딩 시대에서 주니어 개발자로 살아남는 방법
utilforever
1
150
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
850
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
110
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
410
Building an army of robots
kneath
306
46k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
Skip the Path - Find Your Career Trail
mkilby
1
170
A designer walks into a library…
pauljervisheath
211
24k
Designing Powerful Visuals for Engaging Learning
tmiket
1
460
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
350
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
280
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
380
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
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