forked from phalcon/incubator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
needed in 1.2.x cf phalcon/cphalcon#1646 (comment)
- Loading branch information
Olivier Garbé
committed
Mar 11, 2014
1 parent
6e5df22
commit 7623dfb
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/* | ||
+------------------------------------------------------------------------+ | ||
| Phalcon Framework | | ||
+------------------------------------------------------------------------+ | ||
| Copyright (c) 2011-2012 Phalcon Team (http://www.phalconphp.com) | | ||
+------------------------------------------------------------------------+ | ||
| This source file is subject to the New BSD License that is bundled | | ||
| with this package in the file docs/LICENSE.txt. | | ||
| | | ||
| If you did not receive a copy of the license and are unable to | | ||
| obtain it through the world-wide-web, please send an email | | ||
| to license@phalconphp.com so we can send you a copy immediately. | | ||
+------------------------------------------------------------------------+ | ||
| Authors: Andres Gutierrez <andres@phalconphp.com> | | ||
| Eduar Carvajal <eduar@phalconphp.com> | | ||
| Nikita Vershinin <endeveit@gmail.com> | | ||
| Ludomir Crotet <lcrotet@voyageprive.comm> | | ||
| Olivier Garbé <ogarbe@voyageprive.com> | | ||
+------------------------------------------------------------------------+ | ||
*/ | ||
|
||
namespace Phalcon\Forms\Element { | ||
|
||
/** | ||
* Phalcon\Forms\Element\Radio | ||
* | ||
* Component INPUT[type=radio] for forms | ||
*/ | ||
|
||
class Radio extends \Phalcon\Forms\Element implements \Phalcon\Forms\ElementInterface { | ||
|
||
/** | ||
* \Phalcon\Forms\Element constructor | ||
* | ||
* @param string $name | ||
* @param array $attributes | ||
*/ | ||
public function __construct($name, $attributes=null) { | ||
parent::__construct($name, $attributes); | ||
} | ||
|
||
/** | ||
* Renders the element widget returning html | ||
* | ||
* @param array $attributes | ||
* @return string | ||
*/ | ||
public function render($attributes = null){ | ||
$render = ''; | ||
foreach ($attributes->set->items as $key => $item) { | ||
$render .= \Phalcon\Tag::radioField(array($this->getName(), 'value' => $key)).' '.$item.' '; | ||
} | ||
return $render; | ||
} | ||
} | ||
} |