/** * dijit.form.RadioButton * * @param int $id * @param string $content * @param array $params Parameters to use for dijit creation * @param array $attribs HTML attributes * @param array $options Array of radio options * @param string $listsep String with which to separate options * @return string */ public function radioButton($id, $value = null, array $params = array(), array $attribs = array(), array $options = null, $listsep = "<br />\n") { $attribs = $this->_prepareDijit($attribs, $params, 'element'); // Prepare the radio options require_once 'Zend/View/Helper/FormRadio.php'; $formRadio = new Zend_View_Helper_FormRadio(); $formRadio->setView($this->view); return $formRadio->formRadio($id, $value, $attribs, $options, $listsep); }
/** * @group ZF-4191 */ public function testDashesShouldNotBeFilteredFromId() { $name = "Foo"; $options = array(-1 => 'Test -1', 0 => 'Test 0', 1 => 'Test 1'); $formRadio = new Zend_View_Helper_FormRadio(); $formRadio->setView(new Zend_View()); $html = $formRadio->formRadio($name, -1, null, $options); foreach ($options as $key => $value) { $fid = "{$name}-{$key}"; $this->assertRegExp('/<input([^>]*)(id="' . $fid . '")/', $html); } // Assert that radio for value -1 is the selected one $this->assertRegExp('/<input([^>]*)(id="' . $name . '--1")([^>]*)(checked="checked")/', $html); }
/** * Generates a set of radio button elements. * * @access public * * @param string|array $name If a string, the element name. If an * array, all other parameters are ignored, and the array elements * are extracted in place of added parameters. * * @param mixed $value The radio value to mark as 'checked'. * * @param array $options An array of key-value pairs where the array * key is the radio value, and the array value is the radio text. * * @param array|string $attribs Attributes added to each radio. * * @return string The radio buttons XHTML. */ public function formRadio($name, $value = null, $attribs = null, $options = null, $listsep = "\n") { return parent::formRadio($name, $value, $attribs, $options, $listsep); }