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

FluidTYPO3 / flux / 2438
93%

Build:
DEFAULT BRANCH: development
Ran 11 Dec 2016 04:33PM UTC
Jobs 2
Files 176
Run time 23s
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

pending completion
2438

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.

6258 of 6756 relevant lines covered (92.63%)

26.42 hits per line

Jobs
ID Job ID Ran Files Coverage
1 2438.1 (TYPO3_VERSION=">=7.6.13, <7.6.99") 11 Dec 2016 04:31PM UTC 0
92.61
Travis Job 2438.1
2 2438.2 (TYPO3_VERSION=">=7.6.13, <7.6.99") 11 Dec 2016 04:31PM UTC 0
92.63
Travis Job 2438.2
Source Files on build 2438
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #2438
  • fc219687 on github
  • Prev Build on development (#2436)
  • Next Build on development (#2440)
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