本文整理匯總了PHP中I2CE::raiserError方法的典型用法代碼示例。如果您正苦於以下問題:PHP I2CE::raiserError方法的具體用法?PHP I2CE::raiserError怎麽用?PHP I2CE::raiserError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類I2CE
的用法示例。
在下文中一共展示了I2CE::raiserError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createField
/**
* Instantiantiate a field given its short class name
* @param string $formfield the short name of a form field (e.g. STRING_LINE or DATE_YMD)
* @param string $name The name of the field
* @param array $args. Defaults to empty array. The field arguments passed to the constructor
* @returns mixed I2CE_FormField or false on failure
*/
public static function createField($formfield, $name, $args = array())
{
$i2ce_config = I2CE::getConfig()->modules->forms;
if (!$i2ce_config->is_scalar("FORMFIELD/{$formfield}")) {
I2CE::raiseError("Form field type ({$formfield}) has not been registered");
return false;
}
$classname = $i2ce_config->FORMFIELD->{$formfield};
if (!class_exists($classname)) {
I2CE::raiseError("{$formfield} is assoicated to class {$classname} which cannot be found");
return false;
}
@($field = new $classname($name, $args));
if (!$field instanceof I2CE_FormField) {
I2CE::raiserError("{$formfield} is not associated to an instance of I2CE_FormField");
return false;
}
return $field;
}