本文整理汇总了PHP中Field::validateData方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::validateData方法的具体用法?PHP Field::validateData怎么用?PHP Field::validateData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::validateData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateData
public function validateData(MessageStack $errors, Entry $entry, $data = null)
{
if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) {
return self::STATUS_ERROR;
}
if (!isset($data->value)) {
return self::STATUS_OK;
}
if (!is_numeric($data->value)) {
$errors->append(null, (object) array('message' => __("'%s' must be a number.", array($this->{'name'})), 'code' => self::ERROR_INVALID));
return self::STATUS_ERROR;
}
return self::STATUS_OK;
}
示例2: validateData
public function validateData(MessageStack $errors, Entry $entry = null, $data = null)
{
if (empty($data)) {
return self::STATUS_OK;
}
if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) {
return self::STATUS_ERROR;
}
if (!is_null($data->value) && strlen(trim($data->value)) > 0 && !self::__isValidDateString($data->value)) {
$errors->append(null, (object) array('message' => __("The date specified in '%s' is invalid.", array($this->{'publish-label'})), 'code' => self::ERROR_INVALID));
return self::STATUS_ERROR;
}
return self::STATUS_OK;
}
示例3: validateData
public function validateData(MessageStack $errors, Entry $entry = null, $data = null)
{
if (!is_array($data)) {
$data = array($data);
}
$value = NULL;
foreach ($data as $d) {
$value .= $d->value;
}
return parent::validateData($errors, $entry, $this->processData($value, $entry));
}
示例4: validateData
public function validateData(MessageStack $errors, Entry $entry, $data = null)
{
$length = (int) $this->{'text-length'};
if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) {
return self::STATUS_ERROR;
}
if (!isset($data->value)) {
return self::STATUS_OK;
}
if (!$this->applyValidationRules($data->value)) {
$errors->append(null, (object) array('message' => __("'%s' contains invalid data. Please check the contents.", array($this->name)), 'code' => self::ERROR_INVALID));
return self::STATUS_ERROR;
}
if ($length > 0 and $length < strlen($data->value)) {
$errors->append(null, (object) array('message' => __("'%s' must be no longer than %s characters.", array($this->{'name'}, $length)), 'code' => self::ERROR_INVALID));
return self::STATUS_ERROR;
}
return self::STATUS_OK;
}