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
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
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
210
yield再入門 #phpcon
o0h
PRO
0
740
自作OSでスライド発表する
uyuki234
1
3.9k
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
180
音楽のための関数型プログラミング言語mimiumにおける多段階計算の活用
tomoyanonymous
1
360
Built Our Own Background Agent at LayerX #aidevex_findy
layerx
PRO
8
3.3k
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
130
GitHubCopilotCLIのスラッシュコマンドを自作してみる
htkym
0
100
광주소프트웨어마이스터고등학교 DevFest 특강 - 바이브 코딩 시대에서 주니어 개발자로 살아남는 방법
utilforever
1
150
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
340
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
190
AIが無かった頃の素敵な出会いの話
codmoninc
1
220
Featured
See All Featured
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
320
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Six Lessons from altMBA
skipperchong
29
4.3k
A better future with KSS
kneath
240
18k
Code Reviewing Like a Champion
maltzj
528
40k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
640
Designing for humans not robots
tammielis
254
26k
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