Search code examples
typo3typo3-7.6.xtypo3-extensions

TYPO3 perform action only once when multiple same plugins on page


I want editors to be able to insert a plugin multiple times on a page.

Under each record item on the frontpage, there are f:link.actions helpful / not helpful, which could show a comment form.

?tx_bla[question]=2&tx_bla[helpful]=0&tx_bla[action]=helpfulness&tx_bla[controller]=Question

When inserted the plugin twice on a page and clicking on the above link, the action will run twice and show 2 forms.

How can I set that actions only run for the current plugin?


Solution

  • I solved it by getting in the list action the current uid of the plugin

    $cObj = $this->configurationManager->getContentObject();
    $currentUid = $cObj->data['uid'];
    

    assign it to the view and send as argument to the action. There compare the 2 uid's.