[TYPO3-mvc] Standalone View and hidden values in forms e.g. [__referrer][@action]
Matthew Colton
mat.colton at web-xs.de
Sat Dec 20 19:52:41 CET 2014
Hi,
I am developing a special event calendar plugin with Typo3 6.2. The
organisation consists of many venues. The plugin shows the events of all
venues on the organisations website. Each venue can also display their
own events in a custom template. The organisation needs it because quite
a few of the venues include their event list in an iframe on their
website. So the venues can upload fluid templates for event list, event
details, locations, reservation form, reservation confirmation page und
reservation confirmation email.
Everything is fine except the reservation form. The form itself is a
partial that cannot be changed by the venues. Anyway, Extbase normally
adds some hidden fields to a form e.g. "[__referrer][@action]". This
doesn't work in the form. The values are always:
<input type="hidden" name="tx_myext_calendar[__referrer][@extension]"
value="" />
<input type="hidden" name="tx_myext_calendar[__referrer][@controller]"
value="Standard" />
<input type="hidden" name="tx_myext_calendar[__referrer][@action]"
value="index" />
The f:form tag is:
<f:form action="insertCenter" name="reservation" object="{reservation}"
controller="Reservation" pluginName="Calendar" extensionName="Myext"
pageType="161">
The configuration for type 161 is:
reservation = PAGE
reservation {
typeNum = 161
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:text/html
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = NAMESPACE
extensionName = Myext
pluginName = Calendar
controller = Reservation
settings < plugin.tx_myext.settings
persistence.storagePid = {$plugin.tx_myext.persistence.storagePid}
view < plugin.tx_myext.view
}
}
The object reservation is available in the partial, checked it with f:debug.
I don't know how to solve the problem. The action is on pastebin:
http://pastebin.com/ud3bTkc7
and here:
***************************************
/**
*
* @param \NAMESPACE\Myext\Domain\Model\EventDate $eventDate
* @param \NAMESPACE\Myext\Domain\Model\Reservation $reservation
* @ignorevalidation $reservation
*
* @return void
*/
public function
formCenterAction(\NAMESPACE\Myext\Domain\Model\EventDate $eventDate,
\NAMESPACE\Myext\Domain\Model\Reservation $reservation = NULL) {
$this->view = $this->objectManager->get(
'TYPO3\CMS\Fluid\View\StandaloneView'
);
$this->view->setPartialRootPath(
\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName(
'typo3conf/ext/myext/Resources/Private/Partials'
)
);
$templateRootPath =
\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName(
$GLOBALS['TCA']['tx_myext_domain_model_template']['columns']['reservation_form']['config']['uploadfolder']
);
$template = $this->templateRepository->findByUid(
$eventDate->getEvent()->getCenter()->getUid()
);
if ($reservation === NULL) {
$reservation =
$this->objectManager->get('NAMESPACE\Myext\Domain\Model\Reservation');
$reservation->setEventDate($eventDate);
}
if ($template->getReservationForm() !== '') {
$templatePathAndFilename = $templateRootPath . '/' .
$template->getReservationForm();
$this->view->setTemplatePathAndFilename($templatePathAndFilename);
} else {
$this->redirect('missingTemplate',
'Myext',
NULL,
array('center' => $center, 'template' =>
'reservation_form'));
}
$this->view->assign('reservation', $reservation);
$this->view->assign('eventDate', $eventDate);
}
***************************************
Any help is appreciated. Thanks in advance!
--
Cheers
Matthew
More information about the TYPO3-project-typo3v4mvc
mailing list