2008-08-06 08:54:59 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* This is a form decorator that lets you place a form inside another form.
|
|
|
|
* The actions will be appropriately rewritten so that the nested form gets called, rather than the parent form.
|
2014-08-15 08:53:05 +02:00
|
|
|
*
|
2012-04-12 08:02:46 +02:00
|
|
|
* @package framework
|
2009-03-22 23:59:14 +01:00
|
|
|
* @subpackage forms
|
2008-08-06 08:54:59 +02:00
|
|
|
*/
|
|
|
|
class NestedForm extends ViewableData {
|
|
|
|
protected $form;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represent the given form in a tabular style
|
|
|
|
* @param form The form to decorate.
|
|
|
|
*/
|
2012-09-19 12:07:39 +02:00
|
|
|
public function __construct(Form $form) {
|
2008-08-06 08:54:59 +02:00
|
|
|
$this->form = $form;
|
|
|
|
$this->failover = $form;
|
|
|
|
parent::__construct();
|
|
|
|
}
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function Actions() {
|
2008-08-06 08:54:59 +02:00
|
|
|
$actions = $this->form->Actions();
|
|
|
|
foreach($actions as $action) {
|
2014-08-15 08:53:05 +02:00
|
|
|
$action->setFullAction('action_' . $action->actionName()
|
2008-08-06 08:54:59 +02:00
|
|
|
.'?formController=' . str_replace(array('?','.'), array('&','%2e'), $this->form->FormAction()) );
|
|
|
|
}
|
|
|
|
return $actions;
|
|
|
|
}
|
2012-03-24 04:04:52 +01:00
|
|
|
}
|