3.1.4 Registration in PHP

In order to tell Flux that you have added a Provider Extension and that your Provider Extension contains this and that type of template files (e.g. Page and Content templates) you use a small piece of PHP code:

// ext_localconf.php
\FluidTYPO3\Flux\Core::registerProviderExtensionKey('myextensionkey', 'Content');
\FluidTYPO3\Flux\Core::registerProviderExtensionKey('myextensionkey', 'Page');
TYPO3 versions before 6.2 require that you also add these exact same lines in ext_tables.php. This is due to the way TYPO3 caches and loads cached versions of the tables and localconf file types. On TYPO3 6.2 and above, you only need to add this in ext_localconf.php or ext_tables.php - which one you choose doesn't matter, but for consistency we recommend always using ext_localconf.php.

This instructs Flux that a) a new Provider Extension now exists and b) it contains templates for the Content controller type and c) it also contains templates for the Page controller type. It is important to notice that Flux itself does not render these templates (Flux does, however, read the configuration stored within them!) - Flux's role in this case is simply to provide a shared API which can keep track of which Provider Extension contains which template types.

If your Provider Extension contains Controller classes

When your Provider Extensions contain controller classes for any of the controller types you register (ContentController, PageController etc.) there are a few things you must also be aware of. These are:

  1. Flux will detect this controller by checking if the expected class name exists. This means you do not need to configure access to the controller in any way - Flux will handle this for you.
  2. If your Provider Extension uses PHP namespaces (which it should) then your myextensionkey parameter in the registration examples above, should instead of the lowercase extension key contain a combined vendor and extension name, รก la MyVendorName.Myextensionkey. This format will make Flux always look for the namespace based class name - any other format makes Flux look for the old-school Tx_ prefixed class name.
  3. In order for some features to work, as well as in order for fallbacks to be possible, your controller class names should have aliases configured in the EXT:myextensionkey/Migrations/Code/ClassAliasMap.php file (see any TYPO3 core extension for reference). It is intentionally not specified here which features depend on this alias as this detail changes whenever the minimum required TYPO3 core version changes. Rule of thumb is: the higher your TYPO3 core version is, the less likely it is you will need the alias map.
Please note: Flux is an extremely flexible utility and the FluidTYPO3\Flux\Core class contains a wide range of registration methods which are not documented in this chapter, but which will be shown if for example you use an IDE to create your extension. The methods which are documented in this chapter are the simplest ones purely concerned only with templating - and they are by far the most commonly used. Each of the more detailed registration methods have very specific use cases, none of which are relevant in the context of templating.
Jump to...