I try to to build an Extension for TYPO3 with frontend and backend. When trying to start the frontend I get this error:
1297645190: Ext Direct error in "TYPO3\CMS\Core\ExtDirect\ExtDirectApi" with namespace: "TYPO3"\n Try to clear the TYPO3 cache and / or use paramater no_cache=1 as parameter in URL typo3/ajax.php\n\n >
Check also the following points:\n - configuration in ext_localconf.php: registration key should be like "TYPO3.MyExtension.Sample"\n - URL typo3/ajax.php: namespace parameter should be like: "TYPO3.MyExtension"\n - javascript: method\'s name should be like: "TYPO3.MyExtension.Sample.myMethod"\n
Setup.txt
page = PAGE
page.10 = FLUIDTEMPLATE
page.10 {
file = EXT:rere/Resources/Private/Templates/Pruefling/Show.html
layoutRootPath = EXT:rere/Resources/Private/Layouts
}
page.includeJS{
file1 = EXT:rere/Resources/Public/js/jquery-2.1.1.min.js
file2 = EXT:rere/Resources/Public/js/bootstrap.js
file3 = EXT:rere/Resources/Public/js/jquery.tablesorter.min.js
file4 = EXT:rere/Resources/Public/js/Chart.min.js
file5 = EXT:rere/Resources/Public/js/rereGlobal.js
file6 = EXT:rere/Resources/Public/js/notenverwaltung.js
}
page.includeCSS{
file1 = EXT:rere/Resources/Public/css/resultrepository.css
file2 = EXT:rere/Resources/Public/css/bootstrap.min.css
}
ext_localconf.php
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'rere.' . $_EXTKEY, 'rerefrontend', array(
'Modul' => 'list, show, new, newFach, create, edit, update, delete',
'Fach' => 'list, show, new, create, edit, update, delete',
'Note' => 'list, show, new, create, edit, update, delete',
'Pruefling' => 'setPruefling, list, show, new, create, edit, update, delete',
'Intervall' => 'new, create, edit, update',
'Export' => 'exportPrueflinge, exportModuleUndFaecher, exportFach',
'Import' => 'new, importPrueflinge, importBackUp',
'Ajax' => 'searchPruefling',
'Intervall' => 'new, create, edit, update'
),
// non-cacheable actions
array(
'Modul' => 'list, show, new, newFach, create, edit, update, delete',
'Fach' => 'list, show, new, create, edit, update, delete',
'Note' => 'list, show, new, create, edit, update, delete',
'Pruefling' => 'setPruefling, list, show, new, create, edit, update, delete',
'Intervall' => 'new, create, edit, update',
'Export' => 'exportPrueflinge, exportModuleUndFaecher, exportFach',
'Import' => 'new, importPrueflinge, importBackUp',
'Ajax' => 'searchPruefling',
'Intervall' => 'new, create, edit, update'
)
);
I tried without Javascript and CSS but same issue.
Setup is called with
<INCLUDE_TYPOSCRIPT: source="FILE: EXT:rere/Configuration/TyposSript/setup.txt">.
Why do you want to use <f:be.container> in your FE plugin ?
I'm not gonna to give you correct answer as it's your own code you're talking about... you didn't even show it to us?
TIP is, if you don't need f:layout VH for some specific reason don't use it all - it's not required.
Related
In an extension, I would like to be able to modify an existing link. The corresponding field in the database is one which may contain several links (e.g. tt_content.bodytext).
I want to reuse as much already existing functionality as possible. So I would like to use the already existing link wizard.
What I did find was the existing route rteckeditor_wizard_browse_links which uses rte_ckeditor/Classes/Controller/BrowseLinksController.php.
I use this in my view helper:
$parameters = [
'table' => $table,
'fieldName' => $field,
'pid' => $pid,
'uid' => $uid,
'recordType' => $recordType;
];
$urlParameters = [
'contentsLanguage' => 'en',
// 'route'
// 'token*
'P' => $parameters,
'curUrl' => [
'url' => $url
// todo: add anchor text etc. ...
],
'editorId' => 'cke_1'
];
$route = 'rteckeditor_wizard_browse_links';
return (string)$uriBuilder->buildUriFromRoute($route, $urlParameters);
This does opens the link wizard correctly. But it is intertwined with the ckeditor.
When I press "Set link" nothing happens and I get the following JavaScript error (visible if Console is open in Browser):
RteLinkBrowser.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:77 Uncaught TypeError: Cannot read property 'document' of null
at Object.LinkBrowser.finalizeFunction (RteLinkBrowser.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:77)
at HTMLFormElement.UrlLinkHandler.link (UrlLinkHandler.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:40)
at HTMLFormElement.dispatch (jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2)
at HTMLFormElement.y.handle (jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2)
LinkBrowser.finalizeFunction # RteLinkBrowser.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:77
UrlLinkHandler.link # UrlLinkHandler.js?bust=8d6016d70f0f490d5e7d24262f0ec96230f399d9:40
dispatch # jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2
y.handle # jquery.min-16985e7a97b69d2a9c29e484ac3b581a.js:2
The corresponding line in RteLinkBrowser.js is:
var linkElement = RteLinkBrowser.CKEditor.document.createElement('a');
The Link Wizard expects the ckeditor window to be open and uses things in the DOM that are not there.
Is there some way to directly open the link wizard for a specific link within a text field?
Or alternatively open the text field with ckeditor and have the specific link preselected.
I don't have an answer, but at least here is a work-around / alternative:
Don't open Link wizard directly, open field in editor
As an alternative, consider not using the link wizard but using the route 'record_edit' to open the edit dialog for a specific RTE field. If you double-click on a link in that, the link wizard will open.
The following example was taken from linkvalidator in the core and modified. It opens an editor dialog for the field tt_content.bodytext for the record with uid $uid.
$requestUri = GeneralUtility::getIndpEnv('REQUEST_URI') .
'&id=' . $pageid;
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$url = (string)$uriBuilder->buildUriFromRoute('record_edit', [
'edit' => [
'tt_content' => [
$uid => 'edit'
]
],
'columnsOnly' => 'bodytext',
'returnUrl' => $requestUri
]);
Update: For TYPO3 9, a ViewHelper exists for opening the field with FormEngine in the Backend. This has the same result.
https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/backend/latest/Link/EditRecord.html
I am new to typo3 extension development, i have created extension with extension_builder as well as backend module too.
ext_tables.php
if (TYPO3_MODE === 'BE') {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'USER.Webuser',
'web', // Make module a submodule of 'web'
'bewebuser', // Submodule key
'', // Position
[
'Users' => 'list, show, new, create, edit, update, delete',
],
[
'access' => 'user,group',
'icon' => 'EXT:' . $extKey . '/Resources/Public/Icons/user_mod_bewebuser.svg',
'labels' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_bewebuser.xlf',
]
);
}
Typoscript :
# Setting up template
module.tx_webuser_web_webuserbewebuser {
persistence {
storagePid = {$module.tx_webuser_bewebuser.persistence.storagePid}
}
view {
templateRootPaths = EXT:webuser/Resources/Private/Backend/Templates/
partialRootPaths = EXT:webuser/Resources/Private/Backend/Partials/
layoutRootPaths = EXT:webuser/Resources/Private/Backend/Layouts/
}
}
Its working file. here is my BE module:
But, i want to create full area including page tree. Can anyone tell me how to remove page tree for my custom extension use? I want to use entire area for my custom extension.
Thanks an advance!
After taking a look into the source, it seems you can add the option 'navigationComponentId' => '', to the last argument of registerModule to get what you want.
Edit: 2021-02-10. For TYPO3 10 you need to additionally add 'inheritNavigationComponentFromMainModule' => false to the list. I'd assume that only applies if the main module (web in this case) has the page tree activated.
In your example it would be:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'USER.Webuser',
'web', // Make module a submodule of 'web'
'bewebuser', // Submodule key
'', // Position
[
'Users' => 'list, show, new, create, edit, update, delete',
],
[
'access' => 'user,group',
'icon' => 'EXT:' . $extKey . '/Resources/Public/Icons/user_mod_bewebuser.svg',
'labels' => 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_bewebuser.xlf',
'navigationComponentId' => '',
'inheritNavigationComponentFromMainModule' => false,
]
);
I have started a extension under TYPO3 6.2, and migrated this to TYPO3 7. Now it seems, that all links to Controller/Action combinations are broken.
In my TypoScript I have set:
plugin.tx_extensionname.view.pluginNamespace = tx_extensioname
In ext_tables.php I have set:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'Pi1',
'Controller1: DoSomeLogic1'
);
....
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'Pi12',
'Controller12: DoSomeLogic12'
);
In ext_localconf.php the plugins get configured:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'MRU.' . $_EXTKEY,
'Pi2',
array(
'Basket' => 'list, add, remove, address, setDeliveryCountryJson',
'Order' => 'directorder, savedirectorder, accountorder, loginorder, saveloginorder, saveaccountorder, overview, doOrder, paymentSuccess, paymentFailure, paymentNotification, paymentCancel',
'Payment' => 'index'
),
// non-cacheable actions
array(
'Basket' => 'list, add, remove, address, setDeliveryCountryJson',
'Order' => 'directorder, savedirectorder, accountorder, loginorder, saveloginorder, saveaccountorder, overview, doOrder, paymentSuccess, paymentFailure, paymentNotification, paymentCancel',
'Payment' => 'index'
)
);
On a page (id 42) I have placed the plugin Pi2. The Basket Controller is shown with list action. All fine. The URL is like this:
http://www.example.com/index.php?id=42
If I add the namespaced Controller Parameter, like this
http://www.example.com/index.php?id=42&tx_extensionname[controller]=Basket
I get instantly the
#1313855173: The controller "Basket" is not allowed by this plugin. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
Exception. If I add the pluginname to the URI like this
http://www.example.com/index.php?id=42&tx_extensionname_pi2[controller]=Basket
no expecption is thrown. But if I call a action like this
http://www.example.com/index.php?id=42&tx_extensionname_pi2[controller]=Basket&tx_extensionname_pi2[action]=add
this action gets never called. The Controller with it's first action is called.
I did the update some weeks ago, it is only a dev system, but today I cleared all caches and the error occours. Have I missed something with plugin combined namespaces and the registration/configuration/linking of it?
Ok, it seems that this resolve my issue:
plugin.tx_extensionname.mvc.callDefaultActionIfActionCantBeResolved = 1
With callDefaultActionIfActionCantBeResolved = 0 or missing the above, i get the Not Allowed Exception. Settings this to 1 the Controller and Action gets called.
When I try to add the wizard named wizard_geo_selector in TCA ,there arised an error "module not registered".Please tell me how to register the wizard properly in the TCA.?
In TYPO3 Version 7.6 new wizards are added like this:
Inside your extension create the directory Configuration/Backend/
In the new directory create a file Routes.php, it will be found automatically, no mentioning in ext_localconf.php or ext_tables.php is required. If you still need Ajax you can add the file AjaxRoutes.php in the same folder.
Content for Routes.php:
return array(
'my_wizard_element' => array(
'path' => '/wizard/tx_geoselecotor/geo_selector_wizard',
'target' => \Path\To\your\class\WizardGeoSelector::class . '::WizardAction'
),
);
Content for AjaxRoutes.php
<?php
/**
* Definitions for routes provided by EXT:backend
* Contains all AJAX-based routes for entry points
*
* Currently the "access" property is only used so no token creation + validation is made
* but will be extended further.
*/
return array('my_ajax_element' => array(
'path' => 'tx_geoselecotor/my_ajax_route',
'target' => \Path\To\your\class\MyAjaxController::class .'::myAjaxFunction'
));
If you're unsure about the notation you can compare with existing entries in the Global Variables in the Backend:
Navigate to System -> Configuration -> Backend Routes
The route of the paths is handled different, for Ajax it's always "ajax" prepended, so you've never to add it to the path, else it's twice in the route. For the common route there is no change concerning the defined string.
Now the wizard can be used and even it never has to be defined in ext_tables.php it has to be mentioned there from any table-field in the configuration-area (module[name]):
'table_field_for_wizard' => array(
'label' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xml:table_name.tx_myextension_wizard',
'config' => array (
'type' => 'user',
'userFunc' => 'Path/to/class/without/wizard->renderForm',
'wizards' => array(
'my_wizard' => array(
'type' => 'popup',
'title' => 'MyTitle',
'JSopenParams' => 'height=700,width=780,status=0,menubar=0,scrollbars=1',
'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/img/link_popup.gif',
'module' => array(
'name' => 'my_wizard_element',
'urlParameters' => array(
'mode' => 'wizard',
'ajax' => '0',
'any' => '... parameters you need'
),
),
),
'_VALIGN' => 'middle',
'_PADDING' => '4',
),
# Optional
#'softref'=>'something',
),
),
In the userFunc Path/to/class/without/wizard->renderForm you've to create a button which is linking to the wizard and onClick the wizard will open with the route you defined in Routes.php and the optional urlParameters.
Currently I never found this whole item explained in the core-documentation.
Edit:
Details about routing can be found here: Routing
The rendering process can be found here: Rendering / NodeFactory
You should probably read also the outer context of the linked paragraph.
Edit 2:
An example extension can be found here, some things never work 100% but the wizard is working. The extension is for TYPO3 Version 7:
https://github.com/DavidBruchmann/imagemap_wizard
Ricky's answer doesn't really work anymore, since addModulePath ist deprecated since version 7.
Also, just registering the module like this still give's you said error.
The only thing that keeps the wizard going again is this:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('wizard','pbsurvey_answers',"",\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'wizard/');
But when you add this, the module appears as a new point in your TYPO3 backend.
IN TCA add the wizard like follows:
'module' => array(
'name' => 'wizard_geo_selector',
),
In ext_tables.php register the wizard.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'wizard_geo_selector',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/Yourwizardname/'
);
Keep in mind this is deprecated since Typo3 7 and removed in Typo3 8.So you can use this method upto Typo3 7.For Typo3 8 do use the method specified by David below.
I have a plugin http://typo3.org/extensions/repository/view/aw_consume
I'm using it as a content element it's working
When I try to assign to a subpart in my typoscript nothing shows up
LOGOUT < plugin.tx_awconsume.widgets.menu
this plugin was created with the extension_builder extension installed on TYPO3 6.1.4
update 3
plugin.tx_awconsume {
view {
templateRootPath = {$plugin.tx_awconsume.view.templateRootPath}
partialRootPath = {$plugin.tx_awconsume.view.partialRootPath}
layoutRootPath = {$plugin.tx_awconsume.view.layoutRootPath}
}
persistence {
storagePid = {$plugin.tx_awconsume.persistence.storagePid}
}
features {
# uncomment the following line to enable the new Property Mapper.
# rewrittenPropertyMapper = 1
}
widgets {
menu = USER
menu {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = FeAwConsume
extensionName = AwConsume
controller = ConsumerItem
action = list
vendorName = Alexweb
}
}
}
ext_tables.php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'FeAwConsume',
'fe_awconsume'
);
ext_localconf.php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Alexweb.' . $_EXTKEY,
'FeAwConsume',
array(
'ConsumerItem' => 'list, show, new, create, delete',
),
// non-cacheable actions
array(
'ConsumerItem' => 'create, delete',
)
);
I have updated the code snippets according to #lorenz answer but im still getting no output
I have also pushed the latest version in TER 0.1.5
update 4
I did manage to get the expected output only after adding
plugin.tx_awconsume.widgets {
menu = USER
menu {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = FeAwConsume
extensionName = AwConsume
controller = ConsumerItem
action = list
vendorName = Alexweb
}
}
To the template typoscript file from \typo3conf\ext\aw_consume\Configuration\TypoScript\setup.txt
Where it was originally placed by the extension_builder extension however I got a feeling that this is not really a good idea
If you have a close look at your ext_localconf.php, you will notice that you use a vendor name. The vendor name should start with Uppercase so your ext_localconf.php should read:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Alexweb.' . $_EXTKEY,
'MyPlugin',
array(
'ConsumerItem' => 'list, show, new, create, delete',
),
array(
'ConsumerItem' => 'create, delete',
)
);
Your ext_tables.php should look like this:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'MyPlugin',
'Speaking name of my plugin'
);
The TypoScript object of your plugin should include the vendor name (the property is vendorName, not vendor):
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
pluginName = MyPlugin
extensionName = AwConsume
vendorName = Alexweb
controller = ConsumerItem
action = list
Keep in mind that your classes also must include the vendor name/make use of the correct namespace:
namespace Alexweb\AwConsume\Controller;
class ConsumerItemController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
}
Then you should be fine.
The extension name is the UpperCamelCase variant of your extension key, so if your extension key is "aw_consume", your extension name is "AwConsume". This name is used in the classes
The plugin name is the name of a particular plugin that is part of your extension. Since there can be many plugins in an extension, you should choose a fitting name for it. The plugin name should also be UpperCamelCase. You can have multiple plugins for the same controllers, therefore the plugin doesn't have to be named like the controller.
See also http://forge.typo3.org/projects/typo3v4-mvc/wiki/FAQ#What-is-the-Extension-Name