Last active
December 11, 2015 23:58
-
-
Save sauloonze/4680241 to your computer and use it in GitHub Desktop.
Problem to render markdown using Pinocchio.
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
<?php | |
/** | |
* TbForm class file. | |
* | |
* Support for Yii formbuilder | |
* @link <http://www.yiiframework.com/doc/guide/1.1/en/form.builder> | |
* | |
* Usage: | |
* | |
* 1. Create a CForm model | |
* | |
* | |
class FormbuilderTestModel extends CFormModel | |
{ | |
public $search; | |
public $agree; | |
public $radiolist; | |
public function rules() | |
{ | |
return array( | |
array('search', 'required'), | |
array('agree,radiolist', 'boolean'), | |
array('agree', 'compare', 'compareValue' => true, | |
'message' => 'You must agree...'), | |
); | |
} | |
// Change the labels here | |
public function attributeLabels() | |
{ | |
return array( | |
'search'=>'Text search', | |
'selectlist'=>'I agree', | |
); | |
} | |
// return the formbuilder config | |
public function getFormConfig() | |
{ | |
array( | |
'title' => 'Formbuilder test form', | |
'showErrorSummary' => true, | |
'elements' => array( | |
'search' => array( | |
'type' => 'text', | |
'maxlength' => 32, | |
'hint' => 'This is a hint', | |
'placeholder' => 'title', | |
'class' => 'input-large', | |
'append' => '<i class="icon-search"></i>', | |
), | |
'agree' => array( | |
'type' => 'checkbox', | |
// 'hint' => 'Agree to terms and conditions', | |
), | |
'radiolist' => array( | |
'type' => 'radiolist', | |
'items' => array('item1' => '1', 'item2' => '2', 'item3' => '3'), | |
), | |
'buttons' => array( | |
'submit' => array( | |
'type' => 'submit', //@see TbFormButtonElement::$TbButtonTypes | |
'layoutType' => 'primary', //@see TbButton->type | |
'label' => 'Submit', | |
), | |
'reset' => array( | |
'type' => 'reset', | |
'label' => 'Reset', | |
), | |
), | |
) | |
); | |
} | |
* .... | |
* | |
* | |
* @author Joe Blocher <[email protected]> | |
* @copyright Copyright © Joe Blocher 2012 | |
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License | |
* @package bootstrap.widgets | |
*/ | |
Yii::import('bootstrap.widgets.*'); | |
class TbForm extends CForm | |
{ | |
/** ..... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment