[TYPO3-mvc] Using addToInsertRecords (insert record content element) with Extbase
Franz Koch
typo3.RemoveForMessage at elements-net.de
Fri Jan 21 15:28:34 CET 2011
Hey,
> I'm trying to implement the function to render separate models/records
> using the 'insert records' content element. The records should then be
> rendered by the/an action controller of Extbase.
...
> tt_content.shortcut.20.0.conf.tx_hypedirectory_domain_model_contact =<
> tt_content.list.20.hypedirectory_contact
>
> The output in the frontend is:
> "Kontakt nicht gefunden." (Contact not found.)
>
> So it is actually working, but I'm wondering why the contact is
> not found. Do I have to provide the storagePid somewhere additionally,
> or are Extbase controllers _not_ compatible with inserting records?
AFAIK there is no default functionality in extbase that would do this
for your. You have to add the needed logic to your controller yourself
(which shouldn't be a big deal though, but never tried it).
1) you might want to define a specific action that should be used for
rendering a record via the "insertRecord" feature or add a flag in your
settings you use to check for that purpose
2) You have to fetch the related record from the repository yourself
Examples:
----- specific action -----------------------------------
public function singleRecordAction() {
$recordData = $this->request->getContentObjectData();
$this->view->assign('contact',
$this->contactRepository->findOneByUid($recordData['uid']));
}
----- using a setting as flag ----------------------------
/**
...
*/
public function showAction(Tx_HypeDirectory_Domain_Model_Contact
$contact = NULL) {
if ($contact === NULL && $this->settings['renderSingleRecord']) {
$recordData = $this->request->getContentObjectData();
$contact = $this->contactRepository->findOneByUid($recordData['uid']);
}
$this->view->assign('contact', $contact);
}
something like that I suppose - but it's not tested in any way.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list