Skip to content

Commit

Permalink
[FEATURE] bidirectional contact records for pages
Browse files Browse the repository at this point in the history
  • Loading branch information
t3brightside committed Jul 22, 2024
1 parent e2fa958 commit f23c2aa
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 22 deletions.
61 changes: 39 additions & 22 deletions Configuration/TCA/Overrides/pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,50 @@
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

$extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class);
$personnelConiguration = $extensionConfiguration->get('personnel');
$extConf = $extensionConfiguration->get('personnel');

$tempColumns = array(
'tx_personnel_authors' => [
'exclude' => 1,
'label' => 'Persons',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_personnel_domain_model_person',
'foreign_table_where' => 'AND tx_personnel_domain_model_person.sys_language_uid IN (-1,0)',
'size' => '3',
'behaviour' => [
'allowLanguageSynchronization' => true,
if ($extConf['personnelEnableAuthors']) {
$tempColumns = array(
'tx_personnel' => [
'exclude' => 1,
'label' => 'Persons',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_personnel_domain_model_person',
'MM' => 'tx_personnel_mm',
'MM_opposite_field' => 'pages',
'MM_match_fields' => [
'tablenames' => 'pages',
'fieldname' => 'tx_personnel',
],
'size' => 5,
'autoSizeMax' => 5,
'maxitems' => 9999,
'multiple' => 0,
'fieldControl' => [
'editPopup' => [
'disabled' => true,
'options' => [
'windowOpenParameters' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
],
],
'addRecord' => [
'disabled' => true,
],
'listModule' => [
'disabled' => true,
],
],
],
]
],
);

ExtensionManagementUtility::addTCAcolumns('pages', $tempColumns, 1);

if ($personnelConiguration['personnelEnableAuthors']) {
],
);
ExtensionManagementUtility::addTCAcolumns('pages', $tempColumns, 1);
ExtensionManagementUtility::addToAllTCAtypes(
'pages',
'--palette--;Personnel;personnelcontact',
'--palette--;Personnel;personnelInPages',
'1',
'after:subtitle'
);
$GLOBALS['TCA']['pages']['palettes']['personnelcontact']['showitem'] = 'tx_personnel_authors,';
$GLOBALS['TCA']['pages']['palettes']['personnelInPages']['showitem'] = 'tx_personnel,';
}
33 changes: 33 additions & 0 deletions Configuration/TCA/tx_personnel_domain_model_person.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
--palette--;;paletteLanguage,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
selected_categories,
--div--;Pages,pages,
'
]
],
Expand Down Expand Up @@ -563,5 +564,37 @@
],
]
],
'pages' => [
'exclude' => 1,
'label' => 'Pages',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'pages',
'MM' => 'tx_personnel_mm',
'MM_match_fields' => [
'tablenames' => 'pages',
'fieldname' => 'tx_personnel',
],
'size' => 5,
'autoSizeMax' => 5,
'maxitems' => 9999,
'multiple' => 0,
'fieldControl' => [
'editPopup' => [
'disabled' => true,
'options' => [
'windowOpenParameters' => 'height=300,width=500,status=0,menubar=0,scrollbars=1',
],
],
'addRecord' => [
'disabled' => true,
],
'listModule' => [
'disabled' => true,
],
],
],
],
],
];
13 changes: 13 additions & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,17 @@ CREATE TABLE tx_personnel_domain_model_person (

CREATE TABLE pages (
tx_personnel_authors tinytext,
tx_personnel INT UNSIGNED DEFAULT 0 NOT NULL,
);

CREATE TABLE tx_personnel_mm (
uid_local int(11) DEFAULT '0' NOT NULL,
uid_foreign int(11) DEFAULT '0' NOT NULL,
sorting int(11) DEFAULT '0' NOT NULL,
sorting_foreign int(11) DEFAULT '0' NOT NULL,
tablenames varchar(255) DEFAULT '' NOT NULL,
fieldname varchar(255) DEFAULT '' NOT NULL,
PRIMARY KEY (uid_local, uid_foreign),
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);

0 comments on commit f23c2aa

Please sign in to comment.