### Install Mask TYPO3 Extension via Composer Source: https://context7.com/gernott/mask/llms.txt Instructions for installing the Mask TYPO3 extension using Composer and adding it as a dependency in your site package's ext_emconf.php file. This ensures proper loading order. ```bash # Install via Composer composer require mask/mask # Add to ext_emconf.php in your sitepackage $EM_CONF[$_EXTKEY] = [ 'constraints' => [ 'depends' => [ 'mask' => '9.0' ] ] ]; ``` -------------------------------- ### Backend Preview HTML Template Example (HTML) Source: https://github.com/gernott/mask/blob/main/Documentation/BackendPreview/Index.rst An example HTML template for customizing the look of content elements in the TYPO3 backend page module. This template uses placeholders to display data fields like name, email, telephone, fax, and position. ```html Name: {data.tx_mask_name}
E-Mail: {data.tx_mask_email}
Tel.: {data.tx_mask_telephone}
Fax: {data.tx_mask_fax}
Position: {data.tx_mask_position} ``` -------------------------------- ### Add Mask Dependency to composer.json Source: https://github.com/gernott/mask/blob/main/Documentation/Installation/Index.rst This JSON snippet demonstrates how to add Mask as a requirement in your extension's `composer.json` file for composer-based TYPO3 installations. This is particularly relevant for TYPO3 v11 and above, where `ext_emconf.php` may not be necessary. ```json { "require": { "mask/mask": "^8.1" } } ``` -------------------------------- ### Custom DataProcessor Example: VatProcessor (PHP) Source: https://context7.com/gernott/mask/llms.txt An example of a custom DataProcessor that calculates and formats gross prices based on a net price and VAT percentage defined in TypoScript. It demonstrates how to access processor configuration and manipulate the data array before it's passed to Fluid templates. ```php [ 'depends' => [ 'mask' => '8.1' // Add the minimum version here or leave blank for any version. ] ] ]; ``` -------------------------------- ### Run Move RTE Options Migration (Shell) Source: https://github.com/gernott/mask/blob/main/Documentation/Upgrade/Index.rst Executes the 'moveRteOptions' upgrade task for Mask, required when upgrading from v7.0.x or lower to remove the 'options' key from the 'elements' section in JSON files. ```shell ./typo3/sysext/core/bin/typo3 upgrade:run moveRteOptions ``` ```shell ./typo3cms upgrade:run moveRteOptions ``` -------------------------------- ### Run Convert Templates to Uppercase Migration (Shell) Source: https://github.com/gernott/mask/blob/main/Documentation/Upgrade/Index.rst Executes the 'convertTemplatesToUppercase' upgrade task for Mask, used when upgrading from v3 or lower to rename template files to UpperCamelCase, aligning with the FLUIDTEMPLATE content object. ```shell ./typo3/sysext/core/bin/typo3 upgrade:run convertTemplatesToUppercase ``` ```shell ./typo3cms upgrade:run convertTemplatesToUppercase ``` -------------------------------- ### Configure Mask TYPO3 Extension in Site Configuration Source: https://context7.com/gernott/mask/llms.txt Example of how to declare the Mask extension as a dependency within the TYPO3 v13 site configuration YAML file. This is part of the site package setup. ```yaml # TYPO3 v13 Site Set Configuration # EXT:my_site_package/Configuration/Sets/SitePackage/config.yaml name: my-vendor/my-site-package label: My Site Package dependencies: - mask/mask ``` -------------------------------- ### Include Mask Site Set in Site Package Configuration Source: https://github.com/gernott/mask/blob/main/Documentation/Installation/Index.rst This YAML snippet illustrates how to include the Mask site set as a dependency within your site package's `Site set definition` file (`config.yaml`). This is the recommended approach for TYPO3 v13 and above. ```yaml imports: - resource: "EXT:mask/Configuration/Sets/SitePackage/config.yaml" ``` -------------------------------- ### Load RTE Config Presets in ext_localconf.php Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/RTEConfig.rst This PHP snippet demonstrates how to load custom RTE configuration files as presets in TYPO3's ext_localconf.php. It defines new presets named 'custom' and 'simple', referencing the respective YAML configuration files within the sitepackage extension. ```php $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['custom'] = 'EXT:sitepackage/Configuration/RTE/Custom.yaml'; $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['simple'] = 'EXT:sitepackage/Configuration/RTE/Simple.yaml'; ``` -------------------------------- ### Run Remove RichtextConfiguration Migration (Shell) Source: https://github.com/gernott/mask/blob/main/Documentation/Upgrade/Index.rst Executes the 'removeRichtextConfiguration' upgrade task for Mask, necessary when upgrading from v5 or lower to remove 'richtextConfiguration' entries from mask.json due to changes in RTE configuration loading. ```shell ./typo3/sysext/core/bin/typo3 upgrade:run removeRichtextConfiguration ``` ```shell ./typo3cms upgrade:run removeRichtextConfiguration ``` -------------------------------- ### Define Crop Variants for Specific Image Column (PHP) Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/CropVariants.rst This code example shows how to set crop variants for a specific image column, which will be shared across multiple content elements using that column. This is the recommended approach for images within repeater fields. It can be applied to both custom tables and the standard 'tt_content' table. ```php // Use this for repeating fields. File: TCA/Overrides/tx_mask_teasers.php $table = 'tx_mask_teasers'; $column = 'tx_mask_teaser_image'; $GLOBALS['TCA'][$table]['columns'][$column]['config']['overrideChildTca']['columns']['crop']['config']['cropVariants'] = $teaserCropVariants; // Also works in tt_content. File: TCA/Overrides/tt_content.php $table = 'tt_content'; $column = 'image'; $GLOBALS['TCA'][$table]['columns'][$column]['config']['overrideChildTca']['columns']['crop']['config']['cropVariants'] = $teaserCropVariants; ``` -------------------------------- ### Loader Configuration - Extension Settings Source: https://context7.com/gernott/mask/llms.txt This example shows how to configure the Mask loader identifier within extension configuration files like ext_conf_template.txt or the Settings module. It allows switching between different loading strategies, such as a single 'mask.json' file or multiple files using 'json-split'. ```php # Extension Configuration (ext_conf_template.txt or Settings module) # loader_identifier = json # Use single mask.json file # loader_identifier = json-split # Use separate files per element ``` -------------------------------- ### Handle MaskAfterElementDeletedEvent in PHP Source: https://github.com/gernott/mask/blob/main/Documentation/API/Events.rst This PHP code provides an example of an EventListener for the MaskAfterElementDeletedEvent. It illustrates how to retrieve the TableDefinitionCollection and element key of the deleted element, enabling custom actions to be performed after an element is removed. ```php getTableDefinitionCollection(); $elementKey = $event->getElementKey(); // do something after the element is deleted } } ``` -------------------------------- ### Fluid Template Examples for Mask Fields Source: https://context7.com/gernott/mask/llms.txt This Fluid template demonstrates how Mask generates code for different field types, including text, richtext, numbers, dates, files, media, links, select options, inline records, nested content, and categories. It utilizes TYPO3's Fluid ViewHelpers for conditional rendering, formatting, and looping. ```html

{data.tx_mask_headline}

{data.tx_mask_bodytext -> f:format.html()}
{data.tx_mask_price -> f:format.number(decimals: '2', decimalSeparator: ',', thousandsSeparator: '.')}
{file.description}
Read more News Event Other
{contentElement.uid}
{category.title}
``` -------------------------------- ### Run Fill Translation Source Field Migration (Shell) Source: https://github.com/gernott/mask/blob/main/Documentation/Upgrade/Index.rst Executes the 'fillTranslationSourceField' upgrade task for Mask, used when upgrading from TYPO3 v7 / Mask v2 or lower to update custom tables with the new 'l10n_source' language field introduced in TYPO3 v8. ```shell // composer mode vendor/bin/typo3 upgrade:run fillTranslationSourceField // classic mode typo3/sysext/core/bin/typo3 upgrade:run fillTranslationSourceField ``` -------------------------------- ### Target RTE Config Presets in TsConfig Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/RTEConfig.rst This TsConfig snippet shows how to assign a specific RTE preset to a content element's field. It sets the default preset to 'custom' and then targets a specific mask element's richtext field ('tx_mask_content.types.mask_teaser') to use the 'simple' preset. ```ts RTE.default.preset = custom RTE.config.tt_content.tx_mask_content.types.mask_teaser.preset = simple ``` -------------------------------- ### Restructure Override Fields using TYPO3 CLI Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/8.2/Index.rst These shell commands are used to restructure existing content element configurations to utilize the new 'overrideSharedFields' feature in Mask. Two variations are provided: one for composer-based TYPO3 installations and another for classic mode installations. Execute the appropriate command based on your TYPO3 setup. ```shell // composer mode vendor/bin/typo3 mask:restructureOverrideFields ``` ```shell // classic mode typo3/sysext/core/bin/typo3 mask:restructureOverrideFields ``` -------------------------------- ### PHP: Loading TableDefinitionCollection via LoaderRegistry Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/7.1/Index.rst Illustrates how to retrieve the TableDefinitionCollection using the LoaderRegistry service in PHP, a common pattern for accessing configuration. ```php $loaderRegistry = GeneralUtility::makeInstance(LoaderRegistry::class); $tableDefinitionCollection = $loaderRegistry->loadActiveDefinition(); ``` -------------------------------- ### StorageRepository: Add, Hide, Activate, and Load Content Elements (PHP) Source: https://context7.com/gernott/mask/llms.txt Demonstrates CRUD operations for content elements using StorageRepository. It covers adding new elements with fields, hiding and activating elements by their identifier, and loading raw JSON configuration. This class handles persistence and definition management. ```php 'myteaser', 'label' => 'Teaser Element', 'shortLabel' => 'Teaser', 'description' => 'A simple teaser block', 'icon' => 'fa-bullhorn', 'color' => '#ff5500' ]; // Define fields for the element $fields = [ [ 'key' => 'tx_mask_headline', 'name' => 'string', // FieldType value 'label' => 'Headline', 'description' => 'Main headline', 'tca' => [ 'config.max' => 100 ] ], [ 'key' => 'tx_mask_bodytext', 'name' => 'richtext', 'label' => 'Content', 'description' => 'Main content area' ], [ 'key' => 'tx_mask_link', 'name' => 'link', 'label' => 'Link', 'description' => 'CTA link' ] ]; // Add and persist the element $json = $this->storageRepository->add($element, $fields, 'tt_content', true); $tableDefinitionCollection = $this->storageRepository->persist($json); } public function hideElement(): void { // Hide element (keeps in JSON but not usable) $this->storageRepository->hide('tt_content', 'myteaser'); } public function activateElement(): void { // Reactivate hidden element $this->storageRepository->activate('tt_content', 'myteaser'); } public function loadConfiguration(): array { // Load raw JSON configuration return $this->storageRepository->load(); } } ``` -------------------------------- ### Git Diff Statistics for Version Comparison Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/7.2/Index.rst Provides a summary of changes between two versions of the Mask project, indicating the number of files changed and the total insertions and deletions. This is useful for understanding the scope of updates. ```shell git diff v7.1.0 main --shortstat ``` -------------------------------- ### PHP: Injecting TableDefinitionCollection Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/7.1/Index.rst Demonstrates how to inject the TableDefinitionCollection class directly into a PHP class constructor for accessing Mask's configuration. ```php public function __construct(TableDefinitionCollection $tableDefinitionCollection) { } ``` -------------------------------- ### Fluid Template Usage of Processed Data Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/DataProcessors.rst Example of how to access processed data within a Fluid template. It displays the product title, net price, and the calculated gross price, demonstrating the use of the 'priceGross' field added by the VatProcessor. ```html Title: {data.tx_mask_title} Price net: {data.tx_mask_price -> f:format.number(decimals: '2')}€ Price gross: {data.priceGross -> f:format.number(decimals: '2')}€ ``` -------------------------------- ### Shell Command for Mask Definition Persistence Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/7.2/Index.rst This command allows for the persistence of the current Mask definition without requiring arguments. It's a utility for managing Mask configurations within the TYPO3 environment. ```shell mask:convert ``` -------------------------------- ### Define Crop Variants for Specific Content Element (PHP) Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/CropVariants.rst This snippet demonstrates how to define and apply crop variants to a specific content element type (cType) in TYPO3. It targets the 'imageManipulation' configuration within the TCA for a given column. This method is suitable for images not placed in repeater fields. ```php $teaserCropVariants = [ 'teaser' => [ 'title' => 'Teaser', 'allowedAspectRatios' => [ 'portrait' => [ 'title' => 'Portrait', 'value' => 3 / 4 ], 'landscape' => [ 'title' => 'Landscape', 'value' => 4 / 3 ], ], ], ]; $table = 'tt_content'; $cType = 'mask_teaser'; $column = 'tx_mask_teaser_image'; $GLOBALS['TCA'][$table]['types'][$cType]['columnsOverrides'][$column]['config']['overrideChildTca']['columns']['crop']['config']['cropVariants'] = $teaserCropVariants; ``` -------------------------------- ### Configure Mask Extension Settings (PHP) Source: https://context7.com/gernott/mask/llms.txt This PHP code snippet demonstrates how to configure the Mask extension's behavior by setting global variables. It specifies the loader type, the path to the main JSON configuration file, and directories for split JSON configurations (content elements, backend layouts). It also defines paths for frontend and backend templates, layouts, and partials. ```php // Configure in ext_localconf.php or via Settings module $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['mask'] = [ // Loader configuration 'loader_identifier' => 'json', // 'json' or 'json-split' 'json' => 'EXT:sitepackage/Configuration/Mask/mask.json', // JsonSplitLoader paths 'content_elements_folder' => 'EXT:sitepackage/Configuration/Mask/ContentElements/', 'backend_layouts_folder' => 'EXT:sitepackage/Configuration/Mask/BackendLayouts/', // Template paths 'frontend' => 'EXT:sitepackage/Resources/Private/Mask/Frontend/Templates/', 'layouts' => 'EXT:sitepackage/Resources/Private/Mask/Frontend/Layouts/', 'partials' => 'EXT:sitepackage/Resources/Private/Mask/Frontend/Partials/', 'backend' => 'EXT:sitepackage/Resources/Private/Mask/Backend/Templates/', 'layouts_backend' => 'EXT:sitepackage/Resources/Private/Mask/Backend/Layouts/', 'partials_backend' => 'EXT:sitepackage/Resources/Private/Mask/Backend/Partials/', 'preview' => 'EXT:sitepackage/Resources/Private/Mask/Backend/Preview/', ]; ``` -------------------------------- ### Convert Mask Definitions via CLI Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/7.2/Index.rst This command-line interface command allows users to convert old Mask definitions to an up-to-date version. It's useful for updating definitions without manual intervention and ensuring compatibility with newer Mask and TYPO3 versions. This command is part of the Mask CLI tools. ```shell vendor/bin/typo3 mask:convert ``` -------------------------------- ### Configure Link Input Field (PHP) Source: https://github.com/gernott/mask/blob/main/Documentation/Fieldtypes/Type/Link.rst This snippet shows the basic configuration for a link input field using the 'inputLink' render type in PHP. It's a common setup for defining input fields in TYPO3's Table Configuration Array (TCA). No external dependencies are required for this basic configuration. ```php 'type' => 'input', 'renderType' => 'inputLink' ``` -------------------------------- ### Override Custom Table Field Configuration in PHP Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/OverrideTCA.rst This example shows how to override TCA for fields within a custom table generated by Mask, typically for repeating fields. It targets the 'tx_mask_custom_table' and modifies the 'tx_mask_your_field' column's configuration. This allows for specific adjustments to fields used in repeating content element structures. ```php $GLOBALS['TCA']['tx_mask_custom_table']['columns']['tx_mask_your_field']['config']['some_option'] = 'some_value'; ``` -------------------------------- ### Run Mask Content Fields Migration Upgrade Wizard via TYPO3 CLI Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/8.1/Index.rst This command executes the necessary upgrade wizard to migrate Mask content fields, addressing changes in persistence and matching for TYPO3 v12. It is essential for ensuring data integrity after the upgrade. ```shell // composer mode vendor/bin/typo3 upgrade:run migrateContentFields // classic mode typo3/sysext/core/bin/typo3 upgrade:run migrateContentFields ``` -------------------------------- ### Edit Icon for Child Elements using TYPO3 Backend ViewHelpers (HTML) Source: https://github.com/gernott/mask/blob/main/Documentation/BackendPreview/Index.rst Demonstrates how to use TYPO3's core Backend ViewHelpers to display an edit icon for each child element within a content element. It iterates through child data and wraps an edit link around a core icon. ```html Edit record
``` -------------------------------- ### Override tt_content TCA for Mask Fields (PHP) Source: https://context7.com/gernott/mask/llms.txt This PHP snippet demonstrates how to override the Table Configuration Array (TCA) for the 'tt_content' table to customize Mask-generated fields. It includes examples for setting maximum lengths, placeholders, evaluation rules, default values for child records, and render types. ```php // EXT:sitepackage/Configuration/TCA/Overrides/tt_content.php // Override field configuration for tt_content fields $GLOBALS['TCA']['tt_content']['columns']['tx_mask_headline']['config']['max'] = 80; $GLOBALS['TCA']['tt_content']['columns']['tx_mask_headline']['config']['placeholder'] = 'Enter headline...'; // Add eval options $GLOBALS['TCA']['tt_content']['columns']['tx_mask_email']['config']['eval'] = 'trim,email'; // Override inline child TCA defaults $GLOBALS['TCA']['tt_content']['columns']['tx_mask_content_field']['config']['overrideChildTca']['columns']['space_before_class']['config']['default'] = 'medium'; // Add custom renderType $GLOBALS['TCA']['tt_content']['columns']['tx_mask_select']['config']['renderType'] = 'selectTree'; ``` -------------------------------- ### Enable Override Shared Fields in PHP Configuration Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/8.2/Index.rst This PHP code snippet demonstrates how to enable the 'overrideSharedFields' feature in the TYPO3 global configuration. This allows for overriding field configurations across different content elements in Mask. Ensure this setting is correctly placed within your TYPO3 installation's configuration. ```php $GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['overrideSharedFields'] = true; ``` -------------------------------- ### MaskProcessor Integration with TypoScript Source: https://context7.com/gernott/mask/llms.txt This TypoScript configuration shows how to integrate the MaskProcessor and add custom DataProcessors. The MaskProcessor is automatically registered at key 100, allowing custom processors to be added at higher keys. ```typoscript # MaskProcessor is automatically registered at key 100 # Add custom DataProcessor after Mask's processor tt_content { mask_myproduct { dataProcessing { # 100 is reserved for MaskProcessor 110 = YourVendor\YourExtension\DataProcessing\VatProcessor 110 { vat = 19 } } } } ``` -------------------------------- ### Folder Field Type Configuration (PHP) Source: https://github.com/gernott/mask/blob/main/Documentation/Fieldtypes/Type/Folder.rst This code snippet shows the basic configuration for a 'folder' field type in PHP. It is used to define a field that allows users to select one or more folders. ```php 'type' => 'folder' ``` -------------------------------- ### InlineHelper Data Resolution in PHP Source: https://context7.com/gernott/mask/llms.txt The InlineHelper class in PHP is used to resolve file references and inline records for frontend output. It provides methods to add file references and inline elements to data arrays, enabling recursive resolution of nested inline fields. ```php inlineHelper->addFilesToData($data, $table); // Add inline/IRRE elements to data array // Recursively resolves inline fields with their own files and nested inlines $this->inlineHelper->addIrreToData($data, $table); } public function getInlineElements( array $parentData, string $inlineFieldKey, string $cType ): array { // Manually retrieve inline elements for custom processing return $this->inlineHelper->getInlineElements( $parentData, $inlineFieldKey, $cType, 'parentid', 'tt_content' ); } } ``` -------------------------------- ### Loader Configuration - YAML Source: https://context7.com/gernott/mask/llms.txt This YAML snippet demonstrates how to register custom or built-in Mask loaders within a Services.yaml file. It shows registering JsonSplitLoader with an 'json-split' identifier and provides a placeholder for registering a custom loader. ```yaml # Register custom loader in Services.yaml # EXT:your_extension/Configuration/Services.yaml services: MASK\Mask\Loader\JsonSplitLoader: tags: - name: mask.loader identifier: json-split # Or register your own custom loader YourVendor\YourExtension\Loader\CustomLoader: tags: - name: mask.loader identifier: custom ``` -------------------------------- ### TypoScript Configuration for Data Processor Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/DataProcessors.rst TypoScript configuration to register and set up the VatProcessor for a specific Mask content element type ('mask_product'). It specifies the processor class and passes a VAT percentage (19) as a configuration option. ```typoscript tt_content { mask_product { dataProcessing { 110 = VENDOR\Extension\DataProcessing\VatProcessor 110 { vat = 19 } } } } ``` -------------------------------- ### Register MASK EventListeners in YAML Source: https://github.com/gernott/mask/blob/main/Documentation/API/Events.rst This YAML configuration demonstrates how to register EventListeners for MASK events within a TYPO3 extension. It shows the service definition, tag, identifier, and the specific event each listener should subscribe to, enabling custom code execution on element save and delete. ```yaml services: VENDOR\Extension\EventListener\MaskAfterElementSavedEventListener: tags: - name: event.listener identifier: 'executeCodeAfterChange' event: MASK\Mask\Event\MaskAfterElementSavedEvent VENDOR\Extension\EventListener\MaskAfterElementDeletedEventListener: tags: - name: event.listener identifier: 'executeCodeAfterDeletion' event: MASK\Mask\Event\MaskAfterElementDeletedEvent ``` -------------------------------- ### Convert Mask JSON to Split JSON Files (Shell) Source: https://github.com/gernott/mask/blob/main/Documentation/ChangeLog/7.1/Index.rst This command-line utility converts a single mask.json file into multiple split JSON files. It can be executed using the TYPO3 console or the vendor/bin/typo3 script. This is useful for migrating existing configurations or persisting the current format. ```shell > vendor/bin/typo3 mask:convert json json-split // or with typo3 console > vendor/bin/typo3cms mask:convert json json-split // Persist your current format (E.g. for updating after TYPO3 upgrade) > vendor/bin/typo3 mask:convert json ``` -------------------------------- ### PHP Data Processor for VAT Calculation Source: https://github.com/gernott/mask/blob/main/Documentation/Guides/DataProcessors.rst A PHP class implementing the DataProcessorInterface to calculate gross price from a net price and a VAT percentage. It takes VAT as a configuration parameter and adds a 'priceGross' field to the processed data. This processor is intended to be placed in `Classes/DataProcessing/`. ```php 'radio' ```