当前位置: 首页>>代码示例>>PHP>>正文


PHP PodsForm::repeatable_field_types方法代码示例

本文整理汇总了PHP中PodsForm::repeatable_field_types方法的典型用法代码示例。如果您正苦于以下问题:PHP PodsForm::repeatable_field_types方法的具体用法?PHP PodsForm::repeatable_field_types怎么用?PHP PodsForm::repeatable_field_types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PodsForm的用法示例。


在下文中一共展示了PodsForm::repeatable_field_types方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_pod_item

 /**
  * Add or edit a single pod item
  *
  * $params['pod'] string The Pod name (pod or pod_id is required)
  * $params['pod_id'] string The Pod ID (pod or pod_id is required)
  * $params['id'] int The item ID
  * $params['data'] array (optional) Associative array of field names + values
  * $params['bypass_helpers'] bool Set to true to bypass running pre-save and post-save helpers
  * $params['track_changed_fields'] bool Set to true to enable tracking of saved fields via PodsAPI::get_changed_fields()
  *
  * @param array|object $params An associative array of parameters
  *
  * @return int The item ID
  *
  * @since 1.7.9
  */
 public function save_pod_item($params)
 {
     global $wpdb;
     $params = (object) pods_str_replace('@wp_', '{prefix}', $params);
     $tableless_field_types = PodsForm::tableless_field_types();
     $repeatable_field_types = PodsForm::repeatable_field_types();
     $simple_tableless_objects = PodsForm::simple_tableless_objects();
     // @deprecated 2.0
     if (isset($params->datatype)) {
         pods_deprecated('$params->pod instead of $params->datatype', '2.0');
         $params->pod = $params->datatype;
         unset($params->datatype);
         if (isset($params->pod_id)) {
             pods_deprecated('$params->id instead of $params->pod_id', '2.0');
             $params->id = $params->pod_id;
             unset($params->pod_id);
         }
         if (isset($params->data) && !empty($params->data) && is_array($params->data)) {
             $check = current($params->data);
             if (is_array($check)) {
                 pods_deprecated('PodsAPI::save_pod_items', '2.0');
                 return $this->save_pod_items($params, $params->data);
             }
         }
     }
     // @deprecated 2.0
     if (isset($params->tbl_row_id)) {
         pods_deprecated('$params->id instead of $params->tbl_row_id', '2.0');
         $params->id = $params->tbl_row_id;
         unset($params->tbl_row_id);
     }
     // @deprecated 2.0
     if (isset($params->columns)) {
         pods_deprecated('$params->data instead of $params->columns', '2.0');
         $params->data = $params->columns;
         unset($params->columns);
     }
     if (!isset($params->pod)) {
         $params->pod = false;
     }
     if (isset($params->pod_id)) {
         $params->pod_id = pods_absint($params->pod_id);
     } else {
         $params->pod_id = 0;
     }
     if (isset($params->id)) {
         $params->id = pods_absint($params->id);
     } else {
         $params->id = 0;
     }
     if (!isset($params->from)) {
         $params->from = 'save';
     }
     if (!isset($params->location)) {
         $params->location = null;
     }
     if (!isset($params->track_changed_fields)) {
         $params->track_changed_fields = false;
     }
     /**
      * Override $params['track_changed_fields']
      *
      * Use for globally setting field change tracking.
      *
      * @param bool
      *
      * @since 2.3.19
      */
     $track_changed_fields = apply_filters('pods_api_save_pod_item_track_changed_fields_' . $params->pod, (bool) $params->track_changed_fields, $params);
     $changed_fields = array();
     if (!isset($params->clear_slug_cache)) {
         $params->clear_slug_cache = true;
     }
     // Support for bulk edit
     if (isset($params->id) && !empty($params->id) && is_array($params->id)) {
         $ids = array();
         $new_params = $params;
         foreach ($params->id as $id) {
             $new_params->id = $id;
             $ids[] = $this->save_pod_item($new_params);
         }
         return $ids;
     }
     // Allow Helpers to know what's going on, are we adding or saving?
//.........这里部分代码省略.........
开发者ID:satokora,项目名称:IT354Project,代码行数:101,代码来源:PodsAPI.php


注:本文中的PodsForm::repeatable_field_types方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。