DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Hooks

Language Service: Register Rewrite Configurator

This hook allows you to register a PHP class which is responsible for preparing URL rewriting for a specific extension (if you're using CoolUri for example).

Registering a hook

To register a Rewrite Configurator the class name inside TYPO3_CONF_VARS should be LanguageService and the function name is registerRewriteConfigurator. The implementation doesn't prescribe a specific function name so you have to specify it by yourself.

Example:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crystalis']['LanguageService']['registerRewriteConfigurator'][] =
    'VENDOR\\ExtKey\\Hooks\\ClassName->functionName';

Prameters

When the hook is called, two parameters will be passed:

Property

Registry

Data type

array

Description

An array containing all registered configurators.

By default the array would look like this:

array(
    'realurl' => 'DanielHaring\\Crystalis\\Configuration\\UrlRewriting\\RealurlConfigurator'
);

Property

LanguageService

Data type

\DanielHaring\Crystalis\Service\LanguageService

Description

The singleton instance of the Language Service.

As a result your implementation should look like the following:

<?php

namespace VENDOR\ExtKey\Hooks;

class ClassName {

    public function functionName($Registry, $LanguageService) {

        // do something

    }

}

Expected return value

The value returned by your method must be of type array and basically should look like the Registry parameter. This means you should provide the extension key to which the configurator belongs to as array key and the fully qualified class name which is responsible for configuration as value.

Of course, you are allowed to pass multiple pairs (key => value) at once.

Example:

return ['cooluri' => \VENDOR\ExtKey\Configuration\UrlRewriting\CoolUriConfigurator::class];

Important Notice: The classes responsible for configuring URL rewriting are obligated to implement the Interface \DanielHaring\Crystalis\Configuration\UrlRewriting\ConfiguratorInterface. If they don't, they're gonna be ignored.

Complete example

A complete implementation of an additional URL handler may look like this:

~/ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crystalis']['LanguageService']['registerRewriteConfigurator'][] =
    'VENDOR\\ExtKey\\Hooks\\LanguageServiceHooks->registerRewriteService';

~/Classes/Hooks/LanguageServiceHooks.php

<?php

namespace VENDOR\ExtKey\Hooks;

class LanguageServiceHooks {

    public function registerRewriteService(array $Registry, $LanguageService) {

        return ['cooluri' => \VENDOR\ExtKey\Configuration\UrlRewriting\CoolUriConfigurator:class];

    }

}

~/Classes/Configuration/UrlRewriting/CoolUriConfigurator.php

<?php

namespace VENDOR\ExtKey\Configuration\UrlRewriting;

class CoolUriConfigurator implements \DanielHaring\Crystalis\Configuration\UrlRewriting\ConfiguratorInterface {

    public function configure() {

        // do some stuff

    }

}