tollwerk / tw-base
Collection of building blocks and view helpers for TYPO3 projects made by tollwerk
Installs: 4 950
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 2
Type:typo3-cms-extension
Requires
- ext-curl: *
- ext-dom: *
- ext-json: *
- soundasleep/html2text: ^1.1
- typo3/cms-core: ^10.4.22
- wyrihaximus/html-compress: ^4.1
Suggests
- sjbr/static-info-tables: Data and API for countries, languages and currencies for use in TYPO3 CMS
- typo3/cms-form: Form Library, Plugin and Editor
Replaces
- tollwerk/tw-base: v4.7.1
- typo3-ter/tw_base: v4.7.1
README
Collection of building blocks and viewhelpers for TYPO3 projects by tollwerk
Domain objects
Models
- Custom
Country
model extendingSJBR\StaticInfoTables\Domain\Model\Country
(when thestatic_info_tables
extension is installed) UnsubmittableFormDefinition
extendingTYPO3\CMS\Form\Domain\Model\FormDefinition
(Form Framework). Use for form definitions in combination with a custom hook to prevent advancing beyond the final form step (see class for hook example)
Repositories
- Custom
CountryRepository
providing the methodfindByIntlPhoneNumber()
to find all countries using a country code starting with particular digits. ExtendsSJBR\StaticInfoTables\Domain\Repository\CountryRepository
when thestatic_info_tables
extension is installed.
Traits
DebuggableRepositoryTrait
— add this to a repository and use thedebugQuery()
method for debugging SQL queries.StoragePidsIgnoringRepositoryTrait
— add this to a repository as a quick and easy way to make it ignore the storage PIDs.
Link handlers
- Telecommunication link handler adding support for phone calls etc.
Services
- Custom
ImageService
extending\TYPO3\CMS\Extbase\Service\ImageService
adding format conversion capabilities - Image compression services (mozjpeg, SVGO)
- Image converters (WebP)
- Primitive LQIP service, creating SVGO previews of raster images
- Text compression services (gzip, brotli)
These services don't work out of the box and require particular software to be available on the server:
- For optimizing JPEG images using the mozjpeg encoder, install the Mozilla JPEG Encoder Project and create a
mozjpeg
alias tojpegtran
. - For creating WebP image variants, install the WebP converter on the server and make sure the cwebp encoder tool is available as
cwebp
on the command line. - For creating AVIV image variants, install the AVIF converter on the server and make sure the encoder tool is available as
avifenc
on the command line. - For compressing SVG images on the fly, install the Node.js based SVGO tool and make sure it's available as
svgo
on the command line. - For creating SVG previews for images with Primitive, install the Go language and Primitive on your server and make sure
primitive
is available on the command line. - For creating gzipped versions of merged CSS and JavaScript files you need to have the GNU Gzip command line utility installed (standard on any Linux system), globally available as
gzip
binary. - For creating Brotli compressed versions of merged CSS and JavaScript files you need to have the Brotli command line utility installed, globally available as
brotli
binary.
Viewhelpers
cta
viewhelper for rendering CallToAction<a>
or<button>
tagsdebug
viewhelper for better debugging of live environmentsheading
viewhelper for semantic document structuringrender
viewhelper for rendering partials & sections with heading context awarenessimage
viewhelper for rendering compressed imagesmedia
viewhelper for responsive imagesuniqid
viewhelperpage.title
viewhelperstructuredData.*
viewhelpers- Viewhelpers for preparing / refining lists of HTML element attributes (empty / non-empty, data attributes, binary attributes)
language
viewhelper to translate a 2-character ISO 639-1 language identifier into a readable label (internal languages only)- Form element viewhelper (returns a Form Framework element by its name)
form.page.elementsByIdentifier
viewhelper (returns an array of all renderable elements of a form page by their identifier)- Link info viewhelper (returns detailed information about a link target)
- SVG icon & icon sprite viewhelpers (returns detailed information about a link target)
format.age
viewhelper for returning a human readable age stringformat.leadingZeroes
viewhelper for returning a formatted number string
Utilities
- Array utility for advanced array operations
- cURL utility for making HTTP requests
- Email utility for sending out mixed HTML / plaintext emails
- TCA utility for easier TCA configuration and manipulation
- Localization utility for enhanced localization with fallback to given translation key
Title Providers
FlexPageTitleProvider
for altering the default title of a page.SeoPageTitleProvider
for applying a dedicated page title for the<title>
element only.
See the title provider documentation for details.
Validators
- Unique object validator for testing whether a unique value is already taken (e.g. for use with the Form Framework)
TCA field evaluations
- NumberEvaluation for numbers with any number of decimals positions. Removes any non-numeric character and converts
,
to.
Console Commands
cleanup:processedfiles
for truncating the table of processed files and deleting the corresponding files from the file systemcleanup:convertedfiles
for deleting the file variants generated by the image converters (WebP)cleanup:nbsp
for replacing non-breaking spaces with regular spaces in RTE fields- update:slugs for updating slugs for given tablenames and fieldnames.
Content Elements
- Custom video content element with multiple sources, poster image and subtitles / captions
AjaxController
A ready-to-use controller and plugin for handling AJAX requests via ?type=4000
. See AjaxController::dispatchAction() for documentation.
Miscellaneous
- Image lazyloading with automatic SVG based preview images (like SQIP; requires particular software on the server)
- Fluid Standalone template renderer
- Email notification tool (HTML emails & plaintext)
- Helper traits for repositories (for debugging SQL queries and for generally ignoring storage PIDs)
To-do
- Test inline images in emails
- Install simplexml for wyrihaximus/html-compress