for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Contains common helper functions needed for forms
*
* @author Sam Stenvall <[email protected]>
* @copyright Copyright © Sam Stenvall 2013-
* @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
*/
class FormHelper
{
* Genereates a cancel button that links to the specified URL
* @param mixed $url the button URL
* @return string the HTML for the button
public static function cancelButton($url)
return TbHtml::linkButton(Yii::t('Forms', 'Cancel'), array(
'url'=>$url,
'color'=>TbHtml::BUTTON_COLOR_INFO,
'class'=>'btn-padded',
));
}
* Generates a nicely formatted help block, useful to explain what a form or
* a page does. Nothing is rendered if the "showHelpBlocks" setting is set
* to false.
* @param string $content the block content
* @return string the HTML for the help block
public static function helpBlock($content)
if (!Setting::getBoolean('showHelpBlocks'))
return;
$output = CHtml::openTag('p', array('class'=>'form-help'));
$output .= TbHtml::icon(TbHtml::ICON_EXCLAMATION_SIGN);
$output .= $content;
$output .= CHtml::closeTag('p');
return $output;