-1

In my Configuration\TCA\Overrides\tx_news_domain_model.php I add option to select field like this:

$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['switchableControllerActions']['newItems']['News->gallery'] = 'Gallery view';

In my ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes']['Controller/NewsController'][] = 'news_extender';

In my extension

namespace Vendor\NewsExtender\Controller\NewsController;

class NewsController extends \GeorgRinger\News\Controller\NewsContoller {

    public function galleryAction()
    {
    ...
    }
}

I get an error: An action "galleryAction" does not exist in controller "GeorgRinger\News\Controller\NewsController" So my guess is no override of actual NewsController happens. My question is if it is possible to add new action to the controller the way I do (['Controller/NewsController'][])? If not, can I achieve this other way? If so provide an example.

Daniel
  • 6,916
  • 2
  • 36
  • 47
Evil Penguin
  • 114
  • 1
  • 11

2 Answers2

0

The first code must go into a ext_localconf file. Please upload full code to eg github.com to take a look as in general it looks good

Georg Ringer
  • 7,779
  • 1
  • 16
  • 34
  • Thank you for your response. There is no more code except **ext_emconf.php** file and `if (!defined ('TYPO3_MODE')) die ('Access denied.');` parts. I changed location of first part to ext_localconf as you suggested, changed namespace from `Vendor\NewsExtender\Controller\NewsController` to `Vendor\NewsExtender\Controller` and changed extension key to `newsextender` with no success. – Evil Penguin Sep 28 '17 at 19:52
0

I don't know what exactly i did to fix it, but as i did my research i found out that my path to controller was wrong, after changing it i spend few more hours clearing cache from BE and reinstalling extension with no result. After adding line function listAction() {} to my NewsController i finally got an error Fatal error: Cannot redeclare GeorgRinger\News\Controller\NewsController::listAction() in D:\live_system\typo3\typo3_src\typo3temp\Cache\Code\news\tx_news_controller_newscontroller.php on line 618. After clearing Typo3temp/Cache manually again and removing listActionfrom my controller all works just fine.

Evil Penguin
  • 114
  • 1
  • 11