當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PodsForm::pre_save方法代碼示例

本文整理匯總了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) {
開發者ID:satokora,項目名稱:IT354Project,代碼行數:67,代碼來源:PodsAPI.php


注:本文中的PodsForm::pre_save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。