Skip to content

Commit

Permalink
[FEATURE] Make insert record available #508
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed May 1, 2024
1 parent f8b7a93 commit c596fa3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Classes/Controller/AddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;

/**
* AddressController
Expand Down Expand Up @@ -74,8 +75,13 @@ public function showAction(Address $address = null)
*/
public function listAction(?array $override = [])
{
$contentData = $this->configurationManager->getContentObject()->data;
$demand = $this->createDemandFromSettings();

if (isset($contentData['first_name'], $contentData['birthday']) && (int)($this->settings['insertRecord'] ?? 0) === 1) {
$demand->setSingleRecords((string)$contentData['uid']);
}

if (!empty($override) && $this->settings['allowOverride']) {
$this->overrideDemand($demand, $override);
}
Expand All @@ -98,7 +104,7 @@ public function listAction(?array $override = [])
$this->view->assignMultiple([
'demand' => $demand,
'addresses' => $addresses,
'contentObjectData' => $this->configurationManager->getContentObject()->data,
'contentObjectData' => $contentData,
]);

CacheUtility::addCacheTagsByAddressRecords(
Expand Down
17 changes: 17 additions & 0 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,20 @@ plugin.tx_ttaddress {
}
}
}


# Rendering of tt_address, displayed by "Insert Record" content element
tt_content.shortcut.variables.shortcuts.tables := addToList(tt_address)
tt_content.shortcut.variables.shortcuts.conf.tt_address = USER
tt_content.shortcut.variables.shortcuts.conf.tt_address {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = TtAddress
pluginName = ListView
vendorName = FriendsOfTYPO3

settings =< plugin.tx_ttaddress.settings
settings {
displayMode = single
insertRecord = 1
}
}

0 comments on commit c596fa3

Please sign in to comment.