本文整理汇总了PHP中DataTables\Editor::inData方法的典型用法代码示例。如果您正苦于以下问题:PHP Editor::inData方法的具体用法?PHP Editor::inData怎么用?PHP Editor::inData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataTables\Editor
的用法示例。
在下文中一共展示了Editor::inData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Check the validity of the field based on the data submitted. Note that
* this validation is performed on the wire data - i.e. that which is
* submitted, before any setFormatter is run
*
* Called by the Editor / Join class instances - not expected for general
* consumption - internal.
*
* @param array $data Data submitted from the client-side
* @param Editor $editor Editor instance
* @param * $id Row id that is being validated
* @return boolean|string `true` if valid, string with error message if not
* @internal
*/
public function validate($data, $editor, $id = null)
{
// Three cases for the validator - closure, string or null
if (!count($this->_validator)) {
return true;
}
$val = $this->_readProp($this->name(), $data);
for ($i = 0, $ien = count($this->_validator); $i < $ien; $i++) {
$validator = $this->_validator[$i];
$processData = $editor->inData();
$instances = array('action' => $processData['action'], 'id' => $id, 'field' => $this, 'editor' => $editor, 'db' => $editor->db());
if (is_string($validator['func'])) {
// Don't require the Editor namespace if DataTables validator is given as a string
if (strpos($validator['func'], "Validate::") === 0) {
$res = call_user_func("\\DataTables\\Editor\\" . $validator['func'], $val, $data, $validator['opts'], $instances);
} else {
$res = call_user_func($validator['func'], $val, $data, $validator['opts'], $instances);
}
} else {
$func = $validator['func'];
$res = $func($val, $data, $this, $instances);
}
// Check if there was a validation error and if so, return it
if ($res !== true) {
return $res;
}
}
// Validation methods all run, must be valid
return true;
}
示例2: validate
/**
* Check the validity of the field based on the data submitted. Note that
* this validation is performed on the wire data - i.e. that which is
* submitted, before any setFormatter is run
*
* Called by the Editor / Join class instances - not expected for general
* consumption - internal.
* @param array $data Data submitted from the client-side
* @param Editor $editor Editor instance
* @return boolean Indicate if a field is valid or not.
* @internal
*/
public function validate($data, $editor)
{
// Three cases for the validator - closure, string or null
if (!$this->_validator) {
return true;
}
$val = $this->_readProp($this->name(), $data);
if (is_string($this->_validator)) {
$processData = $editor->inData();
$instances = array('action' => $processData['action'], 'id' => isset($processData['id']) ? str_replace($editor->idPrefix(), '', $processData['id']) : null, 'field' => $this, 'editor' => $editor, 'db' => $editor->db());
// Don't require the Editor namespace if DataTables validator is given as a string
if (strpos($this->_validator, "Validate::") === 0) {
return call_user_func("\\DataTables\\Editor\\" . $this->_validator, $val, $data, $this->_validatorOpts, $instances);
}
return call_user_func($this->_validator, $val, $data, $this->_validatorOpts, $instances);
}
$validator = $this->_validator;
return $validator($val, $data, $this);
}