This is more like a basic question:
How do I get an extension (by Extension Builder) to run a simple PHP code without adding a domain model and actions?
This is more like a basic question:
How do I get an extension (by Extension Builder) to run a simple PHP code without adding a domain model and actions?
In general, there are 3 options:
I would still go with option number 3 and therefore you still will need an action. Having actions is good because of you add a 2nd variant, you can just use a 2nd action and there is not much additional code you need.
Having such an extension is fairly easy. One example I did lately was this extension: https://github.com/sup7even/mailchimp
In general you need:
ext_localconf.php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Sup7even.' . $_EXTKEY,
'Registration',
array(
'Form' => 'index,response,ajaxResponse'
),
array(
'Form' => 'index,response,ajaxResponse'
)
);
ext_tables.php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Sup7.' . $_EXTKEY,
'Registration',
'Mailchimp'
);
And the RegistrationController. By default, the first action will be called which is in this case index, therefore you need an indexAction
and the Template must be Templates/Registration/Index.html
.