Mikael
Mikael

Reputation: 1319

TYPO3 ajax The default controller for extension and plugin can not be determined

I have TYPO3 7.6.18 and I trying ajax on front end and I get error 'The default controller for extension \"fefiles\" and plugin \"piphoto\" can not be determined'.

setup.txt

ajaxCall = PAGE
ajaxCall {
   typeNum = 22222
   config {
    disableAllHeaderCode = 1
    xhtml_cleaning = 0
    admPanel = 0
    additionalHeaders = Content-type: text/plain
    no_cache = 1
    debug = 0
   }
   10 = USER
   10 {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        extensionName = fefiles
        pluginName = Piphoto
        vendorName = Istar
        controller = Photo
        action = ajaxHandler
   }
}

ext_tables.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    $_EXTKEY,
    'Piphoto',
    'Upload Photo'
);

js

jQuery(function($) {
    $(".send-photo-comment").click(function (e) {
        e.preventDefault();
        $.ajax({
            type: "POST",
            url: "?id=0&type=22222",
            data: {},
            success: function(msg){
                console.log(msg);
            }
        });
    })
})

ext_localconf

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Istar.' . $_EXTKEY,
    'Piphoto',
    [
        'Photo' => 'list, ajaxHandler, show, new, create, edit, update, delete',
    ],
    // non-cacheable actions
    [
        'Photo' => 'list, ajaxHandler, show, new, create, edit, update, delete',
    ]
);

Help me please) 

Upvotes: 2

Views: 1134

Answers (2)

Marcus
Marcus

Reputation: 1017

This basically means that you need to define a controller in your ext_localconf.php. Usually the first entry is taken as default controller/action. Here's an example:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
  'YourVendor.' . $_EXTKEY,

  // Plugin name
  'Pi1',

  // An array of controller-action combinations. The first one found is the default one.
  array(
    'YourController' => 'index,new,create,edit,update'
  ),

  // An array of non-cachable controller-action-combinations (they must already be enabled)
  array(                
    'YourController' => 'new,create,edit,update'
  )
);

Upvotes: 0

fred
fred

Reputation: 61

How does your ext_localconf.php look like?
Should include something like:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Istar.' . $_EXTKEY,
    'Piphoto,
    array(
        'Photo' => 'ajaxhandler'
    )
);

Upvotes: 1

Related Questions