[TYPO3-extbase] Problem with TCA and flexform in BackEnd
Toke Herkild
th at t3cms.dk
Wed Oct 28 14:40:49 CET 2015
Hi all,
Have an extension where attached snippet is used to extend fe_users.
Problem is as follows:
1: We have 3 versions of fe_user: undefined,
Tx_Extbase_Domain_Model_FrontendUser, Tx_Aftenbooking_Company
2: If undefined og TX_.._FrontendUser is selected then BE editing works
fine. If Tx_Aftenbooking_Company is selected then fe_user formfields is
not filled from db, the form fields are drawn according to TCA, but
record->values are not filled in.
3: If used in FE through extbase Domain\Model then both Company and
FrontendUser works as expected, and fe_users updated correctly.
4: Backend: Configuration->TCA->fe_users: types, columns and
tx_extbase_type is filled and all versions of Fe_users registered and
configured.
Any one got an idea as to what could cause this behaviour ?
Regards,
Toke Herkild
---
Denne e-mail blev kontrolleret for virusser af Avast antivirussoftware.
https://www.avast.com/antivirus
-------------- next part --------------
if (!isset($GLOBALS['TCA']['fe_users']['ctrl']['type'])) {
if (file_exists($GLOBALS['TCA']['fe_users']['ctrl']['dynamicConfigFile'])) {
require_once($GLOBALS['TCA']['fe_users']['ctrl']['dynamicConfigFile']);
}
// no type field defined, so we define it here. This will only happen the first time the extension is installed!!
$GLOBALS['TCA']['fe_users']['ctrl']['type'] = 'tx_extbase_type';
$tempColumns = array();
$tempColumns[$GLOBALS['TCA']['fe_users']['ctrl']['type']] = array(
'exclude' => 1,
'label' => 'LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking.tx_extbase_type',
'config' => array(
'type' => 'select',
'items' => array(),
'size' => 1,
'maxitems' => 1,
)
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tempColumns, 1);
}
if (!isset($GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['type'])) {
if (file_exists($GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['dynamicConfigFile'])) {
require_once($GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['dynamicConfigFile']);
}
// no type field defined, so we define it here. This will only happen the first time the extension is installed!!
$GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['type'] = 'tx_extbase_type';
$tempColumns = array();
$tempColumns[$GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['type']] = array(
'exclude' => 1,
'label' => 'LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking.tx_extbase_type',
'config' => array(
'type' => 'select',
'items' => array(),
'size' => 1,
'maxitems' => 1,
)
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_news_domain_model_news', $tempColumns, 1);
}
$tmp_aftenbooking_columns = array(
'openhours' => array(
'exclude' => 1,
'label' => 'LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking_domain_model_clinic.openhours',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_aftenbooking_domain_model_openhours',
'foreign_field' => 'clinic',
'maxitems' => 9999,
'appearance' => array(
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1
),
),
),
'description' => array(
'exclude' => 1,
'label' => 'LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking_domain_model_clinic.description',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_aftenbooking_domain_model_description',
'foreign_field' => 'clinic',
'maxitems' => 9999,
'appearance' => array(
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'useSortable' => 1,
'showAllLocalizationLink' => 1
),
),
),
'behandlere' => array(
'exclude' => 1,
'label' => 'LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking_domain_model_clinic.behandlere',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_aftenbooking_domain_model_behandler',
'foreign_field' => 'clinic',
'maxitems' => 9999,
'appearance' => array(
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1
),
),
),
);
$tmp_aftenbooking_columns['company'] = array(
'config' => array(
'type' => 'passthrough',
)
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_news_domain_model_news',$tmp_aftenbooking_columns);
$GLOBALS['TCA']['tx_news_domain_model_news']['types']['Tx_Aftenbooking_Clinic']['showitem'] = $TCA['tx_news_domain_model_news']['types']['1']['showitem'];
$GLOBALS['TCA']['tx_news_domain_model_news']['types']['Tx_Aftenbooking_Clinic']['showitem'] .= ',--div--;LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking_domain_model_clinic,';
$GLOBALS['TCA']['tx_news_domain_model_news']['types']['Tx_Aftenbooking_Clinic']['showitem'] .= 'openhours, description, behandlere';
$GLOBALS['TCA']['tx_news_domain_model_news']['columns'][$TCA['tx_news_domain_model_news']['ctrl']['type']]['config']['items'][] = array('LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_news_domain_model_news.tx_extbase_type.Tx_Aftenbooking_Clinic','Tx_Aftenbooking_Clinic');
$tmp_aftenbooking_columns = array(
'cvr' => array(
'exclude' => 1,
'label' => 'LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking_domain_model_company.cvr',
'config' => array(
'type' => 'input',
'size' => 4,
'eval' => 'int'
)
),
'clinics' => array(
'exclude' => 1,
'label' => 'LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking_domain_model_company.clinics',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tx_news_domain_model_news',
'foreign_field' => 'company',
'maxitems' => 9999,
'appearance' => array(
'collapseAll' => 0,
'levelLinksPosition' => 'top',
'showSynchronizationLink' => 1,
'showPossibleLocalizationRecords' => 1,
'showAllLocalizationLink' => 1
),
),
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users',$tmp_aftenbooking_columns);
$GLOBALS['TCA']['fe_users']['types']['Tx_Aftenbooking_Company']['showitem'] = $TCA['fe_users']['types']['0']['showitem'];
$GLOBALS['TCA']['fe_users']['types']['Tx_Aftenbooking_Company']['showitem'] .= ',--div--;LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:tx_aftenbooking_domain_model_company,';
$GLOBALS['TCA']['fe_users']['types']['Tx_Aftenbooking_Company']['showitem'] .= 'cvr, clinics';
$GLOBALS['TCA']['fe_users']['columns'][$TCA['fe_users']['ctrl']['type']]['config']['items'][] = array('LLL:EXT:aftenbooking/Resources/Private/Language/locallang_db.xlf:fe_users.tx_extbase_type.Tx_Aftenbooking_Company','Tx_Aftenbooking_Company');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('fe_users', $GLOBALS['TCA']['fe_users']['ctrl']['type'],'','after:' . $TCA['fe_users']['ctrl']['label']);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_news_domain_model_news', $GLOBALS['TCA']['tx_news_domain_model_news']['ctrl']['type'],'','after:' . $TCA['tx_news_domain_model_news']['ctrl']['label']);
More information about the TYPO3-team-extbase
mailing list