本文整理匯總了PHP中FormControl::get_label方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormControl::get_label方法的具體用法?PHP FormControl::get_label怎麽用?PHP FormControl::get_label使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FormControl
的用法示例。
在下文中一共展示了FormControl::get_label方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: validate_range
/**
* A validation function that returns an error if the value passed is not within a specified range
*
* @param string $value A value to test if it is empty
* @param FormControl $control The control that defines the value
* @param FormContainer $container The container that holds the control
* @param float $min The minimum value, inclusive
* @param float $max The maximum value, inclusive
* @param string $warning An optional error message
* @return array An empty array if the value is value, or an array with strings describing the errors
*/
public static function validate_range($value, $control, $container, $min, $max, $warning = null)
{
if ($value < $min) {
if ($warning == null) {
$warning = _t('The value entered for %s is lesser than the minimum of %d.', array($control->get_label(), $min));
}
return array($warning);
} elseif ($value > $max) {
if ($warning == null) {
$warning = _t('The value entered for %s is greater than the maximum of %d.', array($control->get_label(), $max));
}
return array($warning);
} else {
return array();
}
}