Skip to content

Instantly share code, notes, and snippets.

@sauloonze
Last active December 11, 2015 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sauloonze/4680241 to your computer and use it in GitHub Desktop.
Save sauloonze/4680241 to your computer and use it in GitHub Desktop.
Problem to render markdown using Pinocchio.
<?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 <yii@myticket.at>
* @copyright Copyright &copy; 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