本文整理汇总了PHP中PodsForm::pre_save方法的典型用法代码示例。如果您正苦于以下问题:PHP PodsForm::pre_save方法的具体用法?PHP PodsForm::pre_save怎么用?PHP PodsForm::pre_save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PodsForm
的用法示例。
在下文中一共展示了PodsForm::pre_save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_pod_item
//.........这里部分代码省略.........
foreach ($object_fields as $field => $field_data) {
if (in_array($field, $fields_active)) {
continue;
} elseif (!isset($field_data['default']) || strlen($field_data['default']) < 1) {
continue;
}
$value = PodsForm::default_value(pods_var_raw($field, 'post'), $field_data['type'], $field, pods_var_raw('options', $field_data, $field_data, null, true), $pod, $params->id);
if (null !== $value && '' !== $value && false !== $value) {
$object_fields[$field]['value'] = $value;
$fields_active[] = $field;
}
}
}
// Set default field values for Pod fields
foreach ($fields as $field => $field_data) {
if (in_array($field, $fields_active)) {
continue;
} elseif (!isset($field_data['default']) || strlen($field_data['default']) < 1) {
continue;
}
$value = PodsForm::default_value(pods_var_raw($field, 'post'), $field_data['type'], $field, pods_var_raw('options', $field_data, $field_data, null, true), $pod, $params->id);
if (null !== $value && '' !== $value && false !== $value) {
$fields[$field]['value'] = $value;
$fields_active[] = $field;
}
}
}
$columns =& $fields;
// @deprecated 2.0
$active_columns =& $fields_active;
// @deprecated 2.0
$params->tbl_row_id =& $params->id;
// @deprecated 2.0
$pre_save_helpers = $post_save_helpers = array();
$pieces = array('fields', 'params', 'pod', 'fields_active', 'object_fields', 'custom_fields', 'custom_data', 'track_changed_fields', 'changed_fields');
if (false === $bypass_helpers) {
// Plugin hooks
$hooked = $this->do_hook('pre_save_pod_item', compact($pieces), $is_new_item, $params->id);
if (is_array($hooked) && !empty($hooked)) {
extract($hooked);
}
$hooked = $this->do_hook("pre_save_pod_item_{$params->pod}", compact($pieces), $is_new_item, $params->id);
if (is_array($hooked) && !empty($hooked)) {
extract($hooked);
}
if ($is_new_item) {
$hooked = $this->do_hook('pre_create_pod_item', compact($pieces));
if (is_array($hooked) && !empty($hooked)) {
extract($hooked);
}
$hooked = $this->do_hook("pre_create_pod_item_{$params->pod}", compact($pieces));
if (is_array($hooked) && !empty($hooked)) {
extract($hooked);
}
} else {
$hooked = $this->do_hook('pre_edit_pod_item', compact($pieces), $params->id);
if (is_array($hooked) && !empty($hooked)) {
extract($hooked);
}
$hooked = $this->do_hook("pre_edit_pod_item_{$params->pod}", compact($pieces), $params->id);
if (is_array($hooked) && !empty($hooked)) {
extract($hooked);
}
}
// Call any pre-save helpers (if not bypassed)
if (!defined('PODS_DISABLE_EVAL') || !PODS_DISABLE_EVAL) {