cdaecke / md_newsfrontend

This TYPO3 extension enables feUsers to create news records in the frontend.
Other
3 stars 3 forks source link

Feature Request: Mail to admin on submit #10

Closed ceekay73 closed 5 years ago

ceekay73 commented 5 years ago

Would it be possible to implement a notification mail to a (typoscript) defined mailadress when FE-user creates or updates an entry?

cdaecke commented 5 years ago

I would rather implement a signal slot (TYPO3 Api Reference), so everyone can do everything according to his needs. What do you think?

ceekay73 commented 5 years ago

Sounds good - that's a more general approach.

cdaecke commented 5 years ago

Ok, I will go for that, but I dont have time to do it before middle of June.

cdaecke commented 5 years ago

The following signal slots are added:

I your own extension you catch a signal from the slot in createAction() (so just before saving a new record) with the following lines of code:

ext_localconf.php

$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);

// slot for ext:md_newsfrontend
$signalSlotDispatcher->connect(
    \Mediadreams\MdNewsfrontend\Controller\NewsController::class,
    'createActionBeforeSave',
    \Vendor\Extension\Slot\YourClass::class,
    'yourMethod'
);

The method yourMethod($news, $obj) receives two parameter:

Add your class \Vendor\Extension\Slot\YourClass with the method yourMethod and you are ready to go.

Is this (current master) working for your?

ceekay73 commented 5 years ago

Yes, it's working perfectly. Thanks for implementing this so quickly.

cdaecke commented 5 years ago

Version 1.1.0 is released :-)