Skip to content

Commit

Permalink
adding a checkboxGroup option
Browse files Browse the repository at this point in the history
  • Loading branch information
zeelot committed Jul 14, 2010
1 parent 8707f9c commit 8d07839
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
10 changes: 10 additions & 0 deletions classes/yform/field/checkboxgroup.php
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 {}
37 changes: 37 additions & 0 deletions classes/yuriko/yform/field/checkboxgroup.php
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
13 changes: 13 additions & 0 deletions views/yform/themes/default/choice/checkboxGroup.php
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 -->

0 comments on commit 8d07839

Please sign in to comment.