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; }
<?php /* * This file is part of the symfony package. * (c) Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once dirname(__FILE__) . '/../../bootstrap/unit.php'; $t = new lime_test(1, new lime_output_color()); $dom = new DomDocument('1.0', 'utf-8'); $dom->validateOnParse = true; // ->render() $t->diag('->render()'); $w = new sfWidgetFormSelectMany(array('choices' => array('foo' => 'bar', 'foobar' => 'foo'))); $t->is($w->getOption('multiple'), true, '__construct() creates a multiple select tag');