forked from zeelot/kohana-yform
-
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.
- Loading branch information
Showing
3 changed files
with
60 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,10 @@ | ||
<?php defined('SYSPATH') OR die('No direct access allowed.'); | ||
|
||
/** | ||
* @package YurikoCMS | ||
* @author Lorenzo Pisani - Zeelot | ||
* @copyright (c) 2008-2010 Lorenzo Pisani | ||
* @license http://yurikocms.com/license | ||
*/ | ||
|
||
class YForm_Field_CheckboxGroup extends Yuriko_YForm_Field_CheckboxGroup {} |
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,37 @@ | ||
<?php defined('SYSPATH') OR die('No direct access allowed.'); | ||
/** | ||
* @package YurikoCMS | ||
* @author Lorenzo Pisani - Zeelot | ||
* @copyright (c) 2008-2010 Lorenzo Pisani | ||
* @license http://yurikocms.com/license | ||
*/ | ||
class Yuriko_YForm_Field_CheckboxGroup extends YForm_Field_Group { | ||
|
||
protected $_has_label = TRUE; | ||
|
||
protected $_view = 'choice/checkboxGroup'; | ||
|
||
protected $_options = array(); | ||
|
||
protected $_settings; | ||
|
||
public function __construct($name) | ||
{ | ||
parent::__construct($name); | ||
} | ||
|
||
public function add_options(array $options) | ||
{ | ||
foreach ($options as $value => $name) | ||
{ | ||
$this->_options[$value] = $this->checkbox($value) | ||
->set_label($name); | ||
} | ||
return $this; | ||
} | ||
|
||
public function options() | ||
{ | ||
return $this->_options; | ||
} | ||
} // End Yuriko_YForm_Field_Text |
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,13 @@ | ||
|
||
<!-- BEGIN YForm_CheckboxGroup Element --> | ||
<fieldset class="yform-item yform-checkboxGroup"> | ||
|
||
<?php if( ! empty($label)): ?> | ||
<legend><?php echo $label; ?></legend> | ||
<?php endif; ?> | ||
|
||
<?php foreach ($object->options() as $option): ?> | ||
<?php echo $option; ?> | ||
<?php endforeach; ?> | ||
</fieldset> | ||
<!-- END YForm_CheckboxGroup Element --> |