• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FluidTYPO3 / flux / 2438 / 1
93%
development: 93%

Build:
DEFAULT BRANCH: development
Ran 11 Dec 2016 04:33PM UTC
Files 176
Run time 7s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

11 Dec 2016 04:30PM UTC coverage: 92.611% (-1.0%) from 93.591%
TYPO3_VERSION=">=7.6.13, <7.6.99"

push

travis-ci

mneuhaus
[FEATURE] Add API to register template file as CType (#1241)

The feature will, in all its glorious simpliticy, allow any Flux template to be used as a custom CType. The following code is literally all that is required beside the template file:

```php
// your provider extension's ext_localconf.php

\FluidTYPO3\Flux\Core::registerTemplateAsContentType(
    'My.ExtensionName',
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('extension_name', 'Resources/Private/Templates/Content/Columns.html')
);
```

The rest is entirely handled by Flux, including adding the TCA and pageTSconfig to drive the template.

Custom controller classes can also be used, if they exist in the extension scope. If the controller class also contains an action matching the template basename, then that
action is registered as the action to call when rendering the plugin (thus allowing the same controller to handle multiple content types / templates):

```php
// Still in your extension's ext_localconf.php

\FluidTYPO3\Flux\Core::registerTemplateAsContentType(
    'My.ExtensionName',
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('extension_name', 'Resources/Private/Templates/Content/Columns.html'),
    My\ExtensionName\Controller\SpecialController::class
);
```

And you can also drop-in a `ContentController` in your extension's scope - and Flux will autodetect it. E.g. if class `My\ExtensionName\Controller\ContentController`
exists then this class will be the one rendering your template - also if the class does not contain a matching action. This allows you to manipulate things like initializeView, initializeAction etc.

Finally, when registering your template file a Provider instance gets returned which you can further modify with chained syntax to configure more specific things:

```php
\FluidTYPO3\Flux\Core::registerTemplateAsContentType(
    'My.ExtensionName',
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('extension_name', 'Resources/Private/Templates/Content/Columns.html'),
    My\ExtensionName\Controller\SpecialController::class
    )
    ->setTemplatePaths(['partialRootPaths' => ['Other/Path']])
    ->setTemplateVariables([
        'specialVariable' => 'specialValue'
    ])
    ->setConfigurationSectionName('AlternativeConfiguration')
    ->getForm([])
    ->setOption('allowedContentTypes', 'textmedia')
    ->setOption('static', true);
```

Which can be utilised to modify nearly every aspect of the Flux definition, for example giving them default values based on EM configuration of your extension.

6242 of 6740 relevant lines covered (92.61%)

13.24 hits per line

Source Files on job 2438.1 (TYPO3_VERSION=">=7.6.13, <7.6.99")
  • Tree
  • List 0
  • Changed 9
  • Source Changed 4
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2438
  • Travis Job 2438.1
  • fc219687 on github
  • Prev Job for TYPO3_VERSION=">=7.6.13, <7.6.99" on development (#2436.2)
  • Next Job for TYPO3_VERSION=">=7.6.13, <7.6.99" on development (#2440.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc