Developer corner

Use this section to provide examples of code or detail any information that would be deemed relevant to a developer.

For example explain how a certain feature was implemented.

API

How to use the API...

Interfaces

The following list provides information for all necessary interfaces that are used inside of this documentation. For up to date information, please check the source code.

interface \Vendor\MyExtension\Interfaces\ ExampleInterface

Has to be implemented by all ...

methodOne ( )
returntype

string

Returns:

Something important

interface \Vendor\MyExtension\Interfaces\ AnotherImportantInterface

Used for ...

interface \Vendor\MyExtension\Interfaces\ RequireJsModuleInterface

Widgets implementing this interface will add the provided RequireJS modules. Those modules will be loaded in dashboard view if the widget is added at least once.

getRequireJsModules ( )

Returns a list of RequireJS modules that should be loaded, e.g.:

return [
    'TYPO3/CMS/MyExtension/ModuleName',
    'TYPO3/CMS/MyExtension/Module2Name',
];
Copied!

See also RequireJS (Removed) for further information regarding RequireJS in TYPO3 Backend.

returntype

array

Returns:

List of modules to require.

setDate ( $year, $month, $day)

Set the date.

param int $year

The year.

param int $month

The month.

param int $day

The day.

Returns:

Either false on failure, or the datetime object for method chaining.

Examples

A php example:

// use \TYPO3\CMS\Core\Utility\GeneralUtility;
$stuff = GeneralUtility::makeInstance(
    '\\Foo\\Bar\\Utility\\Stuff'
);
$stuff->do();
Copied!

Example in another language:

$(document).ready(
    function () {
        doStuff();
    }
);
Copied!

A YAML example:

services:
  Vendor\Extension\EventListener\YourListener:
    tags:
      - name: event.listener
        identifier: 'your-self-choosen-identifier'
        method: 'methodToConnectToEvent'
        event: Vendor\MyExtension\Event\MyActionEvent
Copied!