/** * 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); }