Configure full screen backend module for typo3 custom extension - typo3

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,
]
);

Related

using Doctrine With laminas project issue : "Class does not exist"

I just installed Doctrine with my Laminas project. I added a database connection and generated my entities in the Application folder (Application\Entity). I added my entities settings to the module.config.php file in the Application folder. I created a new User and everything, including routing, is working fine. However, when I try to fetch all data from my table to view, the screen displays an error: 'Class 'Application\Entity\User' does not exist'.
i can't find any solution
module
|_Application
|_config
|_Entity
|_src
|_view
|_User
|_config
|_src
|_view
entities settings : namespace : Application
<in Application folder - module.config.php>
'doctrine' => [
'driver' => [
__NAMESPACE__ . '_driver' => [
'class' => AnnotationDriver::class,
'cache' => 'array',
'paths' => [__DIR__ . '/../Entity']
],
'orm_default' => [
'drivers' => [
__NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
],
],
],
],
````
**UserManager**
```
namespace : User\Manager
```
```
public function listUsers()
{
$query = $this->entityManager->getRepository(User::class)->findAll();
return $query;
}
```
**UserController**
```
namespace : User\Controller
```
```
public function listUserAction()
{
$data = $this->usermanager->listUsers();
var_dump($data);
die();
$view = new ViewModel([
'users' => $data
]);
return $view;
}
```
`Entity Folder => Path : Application\Entity`
As this question was already answered in the Laminas forums, I think I should complete this question here, too.
Your folder structure is wrong. The folder where your entities are stored must be a subfolder of the src folder of your application.
./module/Application/src/Entity/User.php
In Laminas projects all business logic is stored in the src folder. The Laminas autoloading will try to receive all classes from there.

how to register extension name and icon in TYPO3 dashboard?

Hello I am newer using TYPO3 version 10 and I need to create an extension basically I need to register my extension under dashboard > web > my_extension
here is my code :
defined('TYPO3_MODE') || die();
/**
* Registers a Backend Module
*/
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
'web',
'MyExt',
'',
'',
[
'routeTarget' => \Localizationteam\L10nmgr\Controller\Manager::class . '::mainAction',
'access' => 'user,group',
'name' => 'web_MyExt',
'icon' => 'EXT:gpi_localizer/Resources/Public/Icons/Extension.svg',
'labels' => 'LLL:EXT:gpi_localizer/Resources/Private/Language/locallang.xlf',
]
);
I don't know why the icon is shown black and the extension name does not appear.
Do you have LLL:EXT:gpi_localizer/Resources/Private/Language/locallang.xlf in place which must at least contain the title of your module.
Regarding the icon I have no idea. Maybe it's somehow transparent?

Data not posted for custom operation

I've got very big trouble with custom operations in Laravel backpack.
The documentated setup is clear but lack a real exemple with a form.
In my case I wanted to use the form engine to create a form for a relationship.
First step I did this :
public function getProtocoleForm($id)
{
// Config base
$this->crud->hasAccessOrFail('update');
$this->crud->setOperation('protocole');
//
$this->crud->addFields([
[ 'name' => 'codeCim',
'type' => 'text',
'label' => 'Code CIM',
],
]);
$this->crud->addSaveAction([
'name' => 'save_action_protocole',
'visible' => function($crud) {
return true;
},
'button_text' => 'Ajouter le procotole',
'redirect' => function($crud, $request, $itemId) {
return $crud->route;
},
]);
// get the info for that entry
$this->data['entry'] = $this->crud->getEntry($id);
$this->data['crud'] = $this->crud;
$this->data['saveAction'] = $this->crud->getSaveAction();
$this->data['title'] = 'Protocole ' . $this->crud->entity_name;
return view('vendor.backpack.crud.protocoleform', $this->data);
}
This is working fine, the form appears on the screen, then I did a setup for a post route like this :
Route::post($segment . '/{id}/protocolestore', [
'as' => $routeName . '.protocolestore',
'uses' => $controller . '#storeProtocole',
'operation' => 'protocole',
]);
The route appears correctly when I execute the artisan command but the storeProtocole function is never called. I checked the generated HTML and the form action is correct and checking in the "network" panel of the browser is also targeting the correct route.
Can you help me and tell me where I missed something ?
[Quick update] I made a mistake, the form route is not good in the HTML, it takes the route of the main controller.

Backend module: Link to another backend module in TYPO3 9

Let's say I have to different extensions with two different backend modules. Registered like:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Vendor.ext',
'ext',
'controller1',
'',
[
'Controller1' => 'any1',
],
[
'access' => 'user,group',
'icon' => '...',
'labels' => '...',
]
);
And in the second extension also like:
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'Vendor.ext2',
'ext2',
'controller2',
'',
[
'Controller2' => 'any2',
],
[
'access' => 'user,group',
'icon' => '...',
'labels' => '...',
]
);
How can I build a link from ext1 in the module to ext2?
What did I tried before in FLUID was:
<f:link.action action="any2" controller="Controller2" extensionName="ext">click me</f:link.action>
or
<f:be.link route="/ext/Ext2Controller2/">click me</f:be.link> (by copying the route that's available via GET parameter)
No luck yet - any ideas? Or how to get the correct route if be.link would be the correct function?
Finally I found the reason.
It's simply possible to use the existing viewhelper like <f:be.link route="lux_LuxLeads">click me</f:be.link>
But the route must be the key and not the path. The key can be picked in the backend module configuration and backendroutes

How to add custom wizards in TYPO3 9 TCA?

Related to How to add custom wizards in typo3 7 TCA? how can costum wizards in TYPO3 9 be implemented? I've added my entry to the Routes.php
return [
'tx_csseo_preview' => [
'path' => '/wizard/tx_csseo/preview',
'target' => \Clickstorm\CsSeo\UserFunc\PreviewWizard::class . '::render'
],
'tx_csseo_permalink' => [
'path' => '/wizard/tx_csseo/permalink',
'target' => \Clickstorm\CsSeo\UserFunc\PermalinkWizard::class . '::render'
]
];
How can I add them now to my TCA field?
'tx_csseo_title' => [
'label' => 'LLL:EXT:cs_seo/Resources/Private/Language/locallang_db.xlf:pages.tx_csseo_title',
'exclude' => 1,
'config' => [
'type' => 'input',
'max' => $extConf['maxTitle'],
'eval' => 'trim',
'fieldWizard' => [
'tx_csseo_preview' => [
'disabled' => false,
]
]
]
],
This does not work. What do I miss? Thanks in advance.
Related to your kind of wizard the registration-process is different and extensive explained here. You can leave the entries in Routes.php away (perhaps even the whole file if nothing else is inside).
Registration is done in ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1485351217] = [
'nodeName' => 'importDataControl',
'priority' => 30,
'class' => \T3G\Something\FormEngine\FieldControl\ImportDataControl::class
];
Then reference the new wizard in TCA:
'somefield' => [
'label' => $langFile . ':pages.somefield',
'config' => [
'type' => 'input',
'eval' => 'int, unique',
'fieldControl' => [
'importControl' => [
'renderType' => 'importDataControl'
]
]
]
],
Then finally the class with the "magic"
declare(strict_types=1);
namespace T3G\Something\FormEngine\FieldControl;
use TYPO3\CMS\Backend\Form\AbstractNode;
class ImportDataControl extends AbstractNode
{
public function render()
{
$result = [
'iconIdentifier' => 'import-data',
'title' => $GLOBALS['LANG']->sL('LLL:EXT:something/Resources/Private/Language/locallang_db.xlf:pages.importData'),
'linkAttributes' => [
'class' => 'importData ',
'data-id' => $this->data['databaseRow']['somefield']
],
'requireJsModules' => ['TYPO3/CMS/Something/ImportData'],
];
return $result;
}
}
In the linked example there is still an Ajax Route with corresponding files, including a special defined route, but that's not required to get the basic wizard shown.
Concerning the registration in ext_localconf.php there is above the number 1485351217 as array-key shown. For an own registered node just calculate once the current time as unix-timestamp and enter that instead. So it's unique and can't be mistaken with other definitions of any registered nodes.
In contrast to the linked example I used slightly different descriptions, so I call the process in ext_localconf.php registering, and the inclusion in TCA referencing. Perhaps this small difference makes it a bit more clear.
Icons
Concerning Icons there is still a difference to earlier TYPO3 versions, they have to be registered now too and in TCA they are only referenced too by the registered name. Here in the TCA-file is no icon referenced but the class below makes usage of it. Here is an example how an icon has to be registered in ext_tables.php:
$systemIconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$systemIconRegistry->registerIcon(
'imagemapwizard_link_edit',
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
[
'source' => 'EXT:imagemap_wizard/Resources/Public/Icons/link_edit.png'
]
);
The new icon registry is implemented starting with TYPO3 version 7.5
Don't forget the configuration in YourExtension/Configuration/Backend/AjaxRoutes.php. See the documentation