public function render($name, $value = null, $attributes = array(), $errors = array()) { sfContext::getInstance()->getConfiguration()->loadHelpers(array('Asset', 'Url')); $id = $this->generateId($name); $choiceWidget = new sfWidgetFormSelectMany(array('choices' => $this->getChoices(), 'is_hidden' => true), array('style' => 'display: none')); $choiceHtml = $choiceWidget->render($name, $this->getValue(), $attributes, $errors); $embeddedForm = $this->renderEmbeddedForms($name); $html = $this->renderDispatch('render', $this->generateId($name), $this->renderDispatch('renderToolbar', $name, ($this->getOption('toolbar-add') ? $this->renderDispatch('renderToolbarButton', $this->getAddJsFunction($name), $this->getOption('toolbar-add-text'), image_path($this->getOption('toolbar-add-image'))) : '') . ($this->getOption('toolbar-clean') ? $this->renderDispatch('renderToolbarButton', $this->getCleanJsFunction($name), $this->getOption('toolbar-clean-text'), image_path($this->getOption('toolbar-clean-image'))) : '') . ($this->getOption('toolbar-reset') ? $this->renderDispatch('renderToolbarButton', $this->getResetJsFunction($name), $this->getOption('toolbar-reset-text'), image_path($this->getOption('toolbar-reset-image'))) : '')), $embeddedForm, $choiceHtml, $this->renderDispatch('renderTitle', $this->getOption('title'))); $html .= '<input type="hidden" value="' . htmlentities($embeddedForm, ENT_COMPAT, "UTF-8") . '" id="_' . $id . '_original_forms" name="_' . $id . '_original_forms" />'; $html .= '<input type="hidden" value="' . htmlentities($choiceHtml) . '" id="_' . $id . '_original_select" name="_' . $id . '_original_select" />'; return $html; }