Extensions play a central role in the development of complex TYPO3 CMS installations. To build effective solutions, every TYPO3 developer needs to know specific programming techniques. Today, the Extbase Framework and the Fluid Templating Engine are regarded as the standard.
This technical book is suited for both beginners and seasoned TYPO3 developers and provides all you need to know to plan and implement projects of any size with Extbase and Fluid. From the basics of object-oriented programming in PHP to the principles of domain-driven design (DDD) and the model-view-controller concept (MVC), the book explains theoretical foundations as well as practical solutions in an easily understandable way. An easy to follow introduction to the basics is followed by a step-by-step guide to developing real-world, complex scenarios using best practices. A dedicated chapter provides details on coding and security standards in TYPO3 and on how to add measures of security and avoid typical vulnerabilities when building extensions.
Gain insight to this advanced topic and learn how to write clean code that complies to modern standards and programming principles for TYPO3 v9 LTS and newer.
Author(s): Schams, Michael
Edition: 3
Publisher: Leanpub
Year: 2019
Language: English
Pages: 405
Tags: typo3, content management system, software development
Preface
Patrick's Background
Michael's Background
Acknowledgements
Piracy
The History of Extbase and Fluid
The Origin of TYPO3
Berlin Manifesto
New PHP Framework
The Death of the Phoenix
The Split
Extbase and Fluid
PHP Programming Basics
Object-Oriented Programming
Classes and Objects
Methods
The Arrow Operator
The Constructor
Access by Using $this
Filling Methods with Content
Inheritance of Classes
Access by Using parent
Verifying Class Derivation
Abstract Classes
Interfaces
Visibility: Public and Protected
Getter and Setter
Type Hints
Return Type Declarations
Strict Types
Static Calls
Namespaces
Important Design Patterns
Singleton
Prototype
Dependency Injection
Annotations
Coding Standards
PSR-1
PSR-2
Code Comments
Domain-driven Design
Infrastructure Ignorance
Vertical-Layered Architecture
The Domain Model
Ubiquitous Language
Building Blocks of DDD
Structuring DDD
Bounded Context
Context Map
Core Domain
Shared Kernel
Recap
Preparation
TYPO3 Pre-installed
Setting Up TYPO3
System Requirements
Installation Using PHP Composer
Site Package
Development Application Context
Extension Fundamentals
Extension Keys
TYPO3 Extension Repository
TER Extensions and Composer
Further Publishing Methods
Extensions, Plugins, Modules, and Distributions
Behind the Scenes
File and Directory Structure
Development Environment
Recap
Create a Domain Model
Domain Model Used in this Book
Basic Concept
The Glossary
Domain Model
The TYPO3 Extension Builder
History
How the Extension Builder Works
Target Audience
Limitations
Installation
Extension Properties
Domain Model
Domain Model Properties
Domain Model Relations
Extension Activation
Autoloading PHP Classes
Recap
Analysing Initial Files
Files Created by the Extension Builder
Files in the Folder Classes/
Files in the Folder Configuration/
Files in the Folder Resources/
Files in the Folder Tests/
Files in the Root Directory
Additional Functionality of the Extension Builder
Modifying the Model
TypoScript constants and setup
Recap
The CRUD Process
Model-View-Controller in Extbase
Creating an Object
Create Action in Controller
Creating the Template for the listAction()
Side Note: Template Rendering
Create Static Blogs
Persisting Blogs
How Persistence Works
The PersistenceManager: Manual Persistence
Create Your Own Action
Form to Create an Object
Reading an Object
Updating an Object
Deleting an Object
Exercise
Fine-tuning of the Visual Appearance
``Font Awesome'' Icons
List View: Align Buttons Right
Button Margins
Recap
Fluid Templating
Templates, Layouts and Partials
Using an Overall Layout
Multiple Sections
Optional Sections
Partials
Simple Partials
Complex Partials
Recap
Query Manager and Repositories
Repository Class
Magic Functions
Default Structure of a Query
Side Note: Debugging
Adjusting Queries
Determine Result Set
Limiting Result Set
Logical Conjunction
Native SQL
Query Settings
Example: Search for Keyword in Title
Dynamic Search in the Repository
Side Note: Request Object
Recap
TypoScript and FlexForm Configuration
TypoScript
Setup Scope
Sub-keys
Option: view
Option: persistence
Option: objects
Option: features
Option: mvc
Option: settings
Option: _LOCAL_LANG
Option: _CSS_DEFAULT_STYLE
FlexForms
FlexForm Configuration
Accessing the FlexForm Configuration
Accessing Settings Outside of a Controller
Switchable Controller Actions (SCA)
TypoScript for Backend Modules
Adjustments for the Next Chapters
Recap
Validation and Error Handling
Point where Validation Happens
Displaying Errors
ViewHelper: Validation Results
Validation Overview
Property Validation
Built-in Validators
Multiple Validators
Custom Validators
Object Validation
Action Validation
Explicitly Ignore Validation
Flash Messages
Generating Flash Messages
Displaying Flash Messages
Flash Message Queues
The Flash Message Queue in a Controller
Practice Option
Recap
ViewHelpers
ViewHelpers in General
Namespace
PHP Class Files
ViewHelpers in the TYPO3 Core
ViewHelpers by the Community
Custom ViewHelpers
Text-ViewHelper
TagBased-ViewHelper
Condition-ViewHelper
Widget-ViewHelper
Test Your Knowledge
Exercise: The Gravatar ViewHelper
Exercise: The A-to-Z Widget
Methods renderStatic() and render()
Recap
Relations
Relation in Domain Model
The Table Configuration Array (TCA)
TCA: ctrl
TCA: interface
TCA: types
TCA: palettes
TCA: columns
The CRUD Process of Posts
Preparation
Create Posts
Read Posts
Update Posts
Delete Posts
m:n-Relations (Tags)
Creation of Tags in the Backend
Repository for Tags
Read Tags in the Post Controller
Templates and Partials Adjustments
Show Tags in List of Posts
1:1-Relations (Authors)
Frontend Users and Groups
Map Author to fe_users
Implementing the Frontend Part
Auto-Assign Frontend User
Obfuscate Email Addresses
Comments as AJAX Requests
Controller and Action
Ajax Controller
Display of Comments
JavaScript
AJAX Page Type in TypoScript
Recap
Labels and Localization
Why Use Language Files?
Language Files
Placeholders
Variables
Update all Template Files
Overwrite Labels in TypoScript
Language Configuration
Website Language
Site Configuration
Page Translation
Content Element Translation
Localized Language File
Overwrite Labels in TypoScript
Language Labels in PHP
Domain Object Localization
The Table Configuration Array (TCA)
Translate Records
Recap
Property Mapper and Type Converter
Property Mapper
Type Converter
Property Mapper Configuration
File Upload Functionality
Security Aspects
Blog Controller
Upload FileReference Converter
Blog Domain Model
TCA of the Blog Domain Model
FileReference Domain Model
TypoScript
Partials and Templates
FormUpload-ViewHelper
File Upload Test
Recap
Backend Module
Requirements and Solution Design
Basic Components
Module Registration
Language File
Abstract Backend Controller
First Function: List Comments
Comment Controller
Fluid Templates
Second Function: Dashboard
Extend Module Registration
Extend Action Menu
Dashboard Controller
Fluid Templates
Visualise Statistical Data
RequireJS
AJAX in the TYPO3 Backend
Add AJAX Functionality to JavaScript
Fine-tuning and Additional Notes
Styleguide Extension
Installation
Usage
Recap
Clean-up and Finalisation
Annotations
PSR-2 Coding Standard (``PHP CodeSniffer'')
DocBlocks (``phpDocumentor'')
Documentation
Recap
Security Basics
TYPO3 Security Team
Security in TYPO3 Extensions
Most Common Security Vulnerabilities
OWASP Top 10
Injection Flaws
Cross-site Scripting
Cross-Site Request Forgery
Lack of Access Control
Further Typical Security Vulnerabilities
What's Next
Get Officially Certified
Appendix
TYPO3 Release History
Extension Declaration File
References and Further Reading
Unofficial Websites
PHP Security
Glossary
Changelog