tollwerk / tw-base
Collection of building blocks and view helpers for TYPO3 projects made by tollwerk
Installs: 5 136
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 2
Type:typo3-cms-extension
pkg:composer/tollwerk/tw-base
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
Countrymodel extendingSJBR\StaticInfoTables\Domain\Model\Country(when thestatic_info_tablesextension is installed) UnsubmittableFormDefinitionextendingTYPO3\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
CountryRepositoryproviding the methodfindByIntlPhoneNumber()to find all countries using a country code starting with particular digits. ExtendsSJBR\StaticInfoTables\Domain\Repository\CountryRepositorywhen thestatic_info_tablesextension 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
ImageServiceextending\TYPO3\CMS\Extbase\Service\ImageServiceadding 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
mozjpegalias tojpegtran. - For creating WebP image variants, install the WebP converter on the server and make sure the cwebp encoder tool is available as
cwebpon the command line. - For creating AVIV image variants, install the AVIF converter on the server and make sure the encoder tool is available as
avifencon the command line. - For compressing SVG images on the fly, install the Node.js based SVGO tool and make sure it's available as
svgoon the command line. - For creating SVG previews for images with Primitive, install the Go language and Primitive on your server and make sure
primitiveis 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
gzipbinary. - For creating Brotli compressed versions of merged CSS and JavaScript files you need to have the Brotli command line utility installed, globally available as
brotlibinary.
Viewhelpers
ctaviewhelper for rendering CallToAction<a>or<button>tagsdebugviewhelper for better debugging of live environmentsheadingviewhelper for semantic document structuringrenderviewhelper for rendering partials & sections with heading context awarenessimageviewhelper for rendering compressed imagesmediaviewhelper for responsive imagesuniqidviewhelperpage.titleviewhelperstructuredData.*viewhelpers- Viewhelpers for preparing / refining lists of HTML element attributes (empty / non-empty, data attributes, binary attributes)
languageviewhelper 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.elementsByIdentifierviewhelper (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.ageviewhelper for returning a human readable age stringformat.leadingZeroesviewhelper 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
FlexPageTitleProviderfor altering the default title of a page.SeoPageTitleProviderfor 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:processedfilesfor truncating the table of processed files and deleting the corresponding files from the file systemcleanup:convertedfilesfor deleting the file variants generated by the image converters (WebP)cleanup:nbspfor 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