TYPO3 Flexform Configuration - typo3

My Flexform configuration doesn't show up. I think everything in the ext_tables.php is wrong.
Maybe something with the path (pluginSignature) is wrong?
defined('TYPO3_MODE') || die('Access denied.');
call_user_func(
function()
{
// Build extension name vars - used for plugin registration, flexforms and similar
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$pluginSignature = strtolower($extensionName) . '_operationsstatistics';
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'FfwLohfelden.OperationsStatistics',
'Operationsstatistics',
'Operations Statistics'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('operations_statistics', 'Configuration/TypoScript', 'Operations Statistics');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_operationsstatistics_domain_model_statistic', 'EXT:operations_statistics/Resources/Private/Language/locallang_csh_tx_operationsstatistics_domain_model_statistic.xlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_operationsstatistics_domain_model_statistic');
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,pages,recursive';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature,
'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForm/flexform_list.xml');
}
);

You can try with below configuration in ext_tables.php file.
//extenstion name
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
//plugin integration
$frontendpluginName = 'plugin name';
$pluginSignature = strtolower($extensionName) . '_'.strtolower(
$frontendpluginName
);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/configure.xml'
);

Related

TYPO3 backend Icon with iconidentifier for custom content element

I registered my icons in ext_localconf.php like this:
<?php
use TYPO3\CMS\Core\Imaging\IconRegistry;
$extKey = 'xxx';
if (TYPO3_MODE === 'BE') {
/** #var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(IconRegistry::class);
$iconRegistry->registerIcon(
'xxx_intro-icon-identifier',
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
['source' => 'EXT:' . $extKey . '/Resources/Public/icons/baseline-web_asset-24px.svg']
);
I want to use the iconidentifier in tt_content.php with \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin() to set the icon for the drop-down menu. Who do I achieve this?
I know this solution:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
'LLL:EXT:your_extension/Resources/Private/Language/locallang_db.xlf:your_ctype.title',
'your_ctype',
'your_icon_identifier'
],
'textmedia',
'after'
);
Place this snippet in Configuration/TCA/Overrides/tt_content.php

typo3 how to add a second backend Module

in my typo3 extension I want to add a second backend modul in navigation.
in ext_tables.php I have this:
if (TYPO3_MODE === 'BE') {
/**
* Creates a Backend Module Category
*/
$modulName = 'InstitutsShop';
//Legt die Position des Moduls fest, hier nach Modul "web"
if (!isset($TBE_MODULES[$modulName])) {
$temp_TBE_MODULES = array();
foreach ($TBE_MODULES as $key => $val) {
if ($key == 'web') {
$temp_TBE_MODULES[$key] = $val;
$temp_TBE_MODULES[$modulName] = '';
} else {
$temp_TBE_MODULES[$key] = $val;
}
}
$TBE_MODULES = $temp_TBE_MODULES;
}
// Hauptmodul erstellen
t3lib_extMgm::addModule($modulName, '', '', t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/BackendModule/');
/**
* Registers a Backend Module
*/
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'TYPO3.' . $_EXTKEY, // $extensionName => vendor + extkey, seperated by a dot
'InstitutsShop', // $mainModuleName => Make module a submodule of 'Auditgarant'
'shopbackend', // $subModuleName => module name
'', // $position => position in the group
array( // Allowed controller -> action combinations
'ShopBackend' => 'list, showOrder',
),
array( // $moduleConfiguratione
'access' => 'user,group',
'icon' => 'EXT:' . $_EXTKEY . '/ext_icon_small.svg',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_shop_backend.xlf',
)
);
/**
* Registers a Backend Module
*/
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'TYPO3.' . $_EXTKEY, // $extensionName => vendor + extkey, seperated by a dot
'InstitutsShop Produkte', // $mainModuleName => Make module a submodule of 'Auditgarant'
'shopbackendproducts', // $subModuleName => module name
'', // $position => position in the group
array( // Allowed controller -> action combinations
'ShopOrdProduct' => 'list',
),
array( // $moduleConfiguratione
'access' => 'user,group',
'icon' => 'EXT:' . $_EXTKEY . '/ext_icon_small.svg',
'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_shop_backend.xlf',
)
);
}
The first one with controller ShopBackend is displayed ...
The second one not.
What could be the issue in this case?
Thanks in advance.
I'd say that the space is not allowed in the mainModuleName. And I don't think that your extension has the vendor TYPO3.

TYPO3 - Custom extension : show in flexform

I made my own extension on TYPO3 6.2 with the Extension Builder, the goal is to let the backend users create events (with name, location, date, number of people etc...) of our company.
I created a backend plugin, it works good.
I created a frontend plugin, but I don't know how to write my flexform file in order to let the backend users choose which event to display (through the "show" action I guess)... Best result would be to get a select list with all existing events.
How to do it ?
In my ext_localconf.php, I have :
<?php
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Mycompany.' . $_EXTKEY,
'Displayevent',
array(
'Event' => 'show',
),
// non-cacheable actions
array(
'Event' => 'show',
)
);
?>
but in frontend there is a Typo3 error :
1298012500: Required argument "event" is not set for Mycompany\MycompanyEvents\Controller\EventController->show
here my showAction() code :
/**
* action show
*
* #param \MyCompany\mycompany_events\Domain\Model\Event $event
* #return void
*/
public function showAction(\MyCompany\mycompany_events\Domain\Model\Event $event) {
$this->view->assign('event', $event);
}
Try to follow below steps to call flexform.
in your ext_tables.php file add below code.
//extenstion name
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
//plugin integration
$frontendpluginName = 'your_plugin_name';
$pluginSignature = strtolower($extensionName) . '_'.strtolower(
$frontendpluginName
);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature,
'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/configure_plugin.xml'
);
Now, create flexform file in this directory /Configuration/FlexForms/ like below and use userFunct for event select list.
<T3DataStructure>
<sheets>
<!--
################################
SHEET General Settings
################################
-->
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>General</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.variable_name>
<TCEforms>
<label>Title</label>
<config>
<type>select</type>
<itemsProcFunc>EXT:ext_key/Classes/Utility/class.tx_event_utility.php:tx_event_utility->getEventList</itemsProcFunc>
<multiple>0</multiple>
<minitems>0</minitems>
<maxitems>50</maxitems>
<size>5</size>
</config>
</TCEforms>
</settings.variable_name>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
Now, Create tx_event_utility.php file on this path /ext_key/Classes/Utility/ like below.
<?php
class tx_event_utility {
protected $objectManager;
protected $configurationManager;
protected $pluginSetting;
protected $objectCategoryRepository;
function __construct() {
$this->objectManager = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
$this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$this->pluginSetting = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$this->objectCategoryRepository = $this->objectManager->get('added repositry namespace');
}
function getEventList($config, $item) {
// write code for geting event list
}
return $config;
}
}
?>
Add file Yourext/Configuration/TCA/Overrides/tt_content.php
<?php
defined('TYPO3_MODE') or die();
// register plugin and flexform
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'yourext',
'Name',
'LLL:EXT: yourext/Resources/Private/Language/locallang_be.xlf:name_plugin'
);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['yourext_name'] = 'select_key';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['yourext_name'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
'yourext_name',
'FILE:EXT:yourext/Configuration/FlexForms/flexform.xml'
);

TYPO3 - TCA in ext_tables.php check and TCA/Overrides for v8

Updated ext_tables.php, TCA and TCA/Overrides for TYPO3 8LTS? I moved the TCA definitions from ext_tables.php to /TCA folder and the query in list view is working again:
ext_tables.php
<?php
if (!defined('TYPO3_MODE')) {die('Access denied.');}
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'Code',
'Description'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_code_domain_model_code', 'EXT:code/Resources/Private/Language/locallang_csh_tx_code_domain_model_code.xlf');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_code_domain_model_code');
Configuration/TCA/tx_code_domain_model_code.php
... // TCA defintions
Configuration/TCA/Overrides/tt_content.php
<?php
if (!defined('TYPO3_MODE')) {die('Access denied.');}
$_EXTKEY = 'code';
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'Code',
'Description'
);
$extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginName = strtolower('Code');
$pluginSignature = $extensionName.'_'.$pluginName;
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$_EXTKEY . '/Configuration/FlexForms/flexform_code.xml');
Configuration/TCA/Overrides/tt_content.php
<?php
if (!defined('TYPO3_MODE')) {die('Access denied.');}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('code', 'Configuration/TypoScript', 'Description');
It's not compatible.
You should do your TCA definition of tx_code_domain_model_code in:
Configuration/TCA/tx_code_domain_model_code.php
The static template definition in:
Configuration/TCA/Overrides/sys_template.php
And your plugin and flexform definition in: Configuration/TCA/Overrides/tt_content.php
Be aware that the $_EXTKEY variable is not defined in those files so you have to type the extension key yourself.

Include extbase plugin via typoscript, when having multiple plugins

In my extbase extension a have multiple plugins, in my ext_tables.php i have :
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY, 'plugin1', 'Services du CSPQ' );
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY, 'plugin2', 'plugin2' );
And in my ext_localconf.php :
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'TYPO3.' . $_EXTKEY, 'plugin1', array(
'Test' => 'list, show',
),
// non-cacheable actions
array('Test' => '',) );
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'TYPO3.' . $_EXTKEY,
'plugin2',
array(
'Test' => 'menu',
),
// non-cacheable actions
array(
'Test' => '',
) );
Now, how can i call the plugin2 by typoscript ?
for example, if i try to insert my plugin2 in lib.leftcontent, i tried this
lib.leftcontent < plugin.tx_plugin2
but nothing happens!
lib.leftcontent = USER
lib.leftcontent {
userFunc = tx_extbase_core_bootstrap->run
pluginName = Plugin2
extensionName = MyExtension
vendorName = Vendor
}
You first need to bootstrap your plugin as described in various article here on Stackoverflow, e.g. How do I bootstrap a plugin on TYPO3 CMS 6.0 with extbase?. Start with
lib.leftcontent = USER
lib.leftcontent {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
...
and add all the other stuff as described in the linked article.
dont forget actions. Like for tx.fe_manager
lib.userview = USER
lib.userview {
userFunc = tx_extbase_core_bootstrap->run
extensionName = Femanager
pluginName = Pi1
vendorName = In2
#controller = Edit
#action = edit
switchableControllerActions {
Edit {
1 = edit
2 = update
3 = delete
4 = confirmUpdateRequest
}
}
}