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
Einsatz eigener Extbase Controller Views
Search
move:elevator
January 17, 2017
Programming
0
300
Einsatz eigener Extbase Controller Views
Vortrag zum Meetup der TYPO3 User Group Dresden
move:elevator
January 17, 2017
Tweet
Share
More Decks by move:elevator
See All by move:elevator
Event Sourcing
moveelevator
0
110
Agile Organisation
moveelevator
0
810
Middleware in TYPO3
moveelevator
0
690
PWA in Practice
moveelevator
0
120
Extbase: Alternativen zu "findAll"
moveelevator
0
440
Structured Data mit TYPO3
moveelevator
0
89
So geht Employer Branding
moveelevator
0
470
Kundenportale mit TYPO3
moveelevator
0
150
React Native Web
moveelevator
1
120
Other Decks in Programming
See All in Programming
SourceGeneratorのマーカー属性問題について
htkym
0
170
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
2
520
Fundamentals of Software Engineering In the Age of AI
therealdanvega
1
230
CSC307 Lecture 12
javiergs
PRO
0
470
CSC307 Lecture 14
javiergs
PRO
0
460
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
170
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
320
文字コードの話
qnighy
44
17k
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
130
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.6k
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
130
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
700
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
980
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
380
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
120
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
200
Facilitating Awesome Meetings
lara
57
6.8k
For a Future-Friendly Web
brad_frost
183
10k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
97
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
140
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
Writing Fast Ruby
sferik
630
63k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
210
Transcript
GROUP
Eigene Extbase Controller Views
Jan Männig, Team Lead CMS-Development move:elevator
1. MVC-Pattern 2. Status Quo 3. Fluid Standard View 4.
Beispiel 5. Weiterführende Informationen Agenda
MVC-Pattern
MVC-Pattern VIEW CONTROLLER MODEL
Status Quo
„Controller, die eierlegende Wollmilchsau“
Status Quo - Auslagerung der Logik in Controller oder in
vom Controller ausgehende Objekte - meistens Abbruch durch die() oder exit
„Schuster, bleib bei deinem Leisten.“
Der View …
FluidTemplateView /** * @package JanMaennig\ExtbaseViewExample\Controller */ class RecordController extends ActionController
{ public function listAction() { $records = $this->recordRepository->findAll(); $this->view->assign('records', $records); } /** * @param \JanMaennig\ExtbaseViewExample\Domain\Model\Record $record */ public function singleAction(Record $record) { $this->view->assign('record', $record); } } Controller (Auszug)
FluidTemplateView <div class="container"> <div class="row"> <div class="col-xs-11"> <h1> {record.title} </h1>
</div> <div class="cols-xc-1"> <f:link.action action="single" controller="RecordPdf" arguments="{record: '{record}'}" additionalParams="{type:1234}"> <span class="glyphicon glyphicon-download"></span> </f:link.action> </div> </div> <div class="row"> <div class="col-xs-12"> <f:image src="{record.images.0.uid}" Template (Auszug)
FluidTemplateView
„Selbst ist der Developer“
Vorab etwas TypoScript
Nutzung eigener Views pdfView = PAGE pdfView { typeNum =
1234 config { admPanel = 0 debug = 0 } 10 < tt_content.list.20.extbaseviewexample_examplerecords } Einbindung des Plugins in eigenen Pagetype
Beispiel
Beispiel PDF-Druck der Detailansicht <?php namespace JanMaennig\ExtbaseViewExample\Controller; use
JanMaennig\ExtbaseViewExample\View\PdfView; /** * @package JanMaennig\ExtbaseViewExample\Controller */ class RecordPdfController extends RecordController { protected $defaultViewObjectName = PdfView::class; } PdfController, zur Änderung des „DefaultViewObjects“
Beispiel PDF-Druck der Detailansicht <?php namespace JanMaennig\ExtbaseViewExample\View; use
TYPO3\CMS\Fluid\View\TemplateView; class PdfView extends TemplateView { /** * @return void */ public function render() { header("Content-type:application/pdf"); $content = parent::render(); $mpdf = new \mPDF(); $mpdf->WriteHTML($content); $mpdf->Output('test.pdf', 'D'); return; } } PdfView abgeleitet vom TemplateView
PDF
Weiterführende Informationen
Weiterführende Informationen Vorteile - Klare Trennung zwischen Ausgabelogik und Controller
- kein „exit“ oder anderweitiger Abbruch der Logik im Controller notwendig - Einhaltung des Slim Controller Prinzips Nachteile - Weiterer Controller notwendig - zum Teil TypoScript (Pagetype) notwendig
Nutzungsmöglichkeiten - PDF-Download - Excel-Export - Verwendung anderer Template-Engines -
Bereitstellung von APIs - AJAX-Calls Weiterführende Informationen
Weitere Links - https://usetypo3.com/json-view.html - https://github.com/janmaennig/extbase-view-example/ Weitere Informationen
Vielen Dank!
Quellen Bilder / Fotos