AdamWathan\Form\Elements\Select::render PHP Method

render() public method

public render ( )
    public function render()
    {
        return implode([sprintf('<select%s>', $this->renderAttributes()), $this->renderOptions(), '</select>']);
    }

Usage Example

コード例 #1
0
ファイル: SelectTest.php プロジェクト: facilinfo/form
 public function testSelectCanBeCreatedWithIntegerKeyValueOptions()
 {
     $select = new Select('color', array('0' => 'Red', '1' => 'Blue'));
     $expected = '<select name="color"><option value="0">Red</option><option value="1">Blue</option></select>';
     $result = $select->render();
     $this->assertEquals($expected, $result);
     $select = new Select('fruit', array('1' => 'Granny Smith', '0' => 'Blueberry'));
     $expected = '<select name="fruit"><option value="1">Granny Smith</option><option value="0">Blueberry</option></select>';
     $result = $select->render();
     $this->assertEquals($expected, $result);
 }
All Usage Examples Of AdamWathan\Form\Elements\Select::render