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


PHP FrmFieldsHelper::fill_field方法代码示例

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


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

示例1: duplicate

 public static function duplicate($old_form_id, $form_id, $copy_keys = false, $blog_id = false)
 {
     global $frm_duplicate_ids;
     $fields = self::getAll(array('fi.form_id' => $old_form_id), 'field_order', '', $blog_id);
     foreach ((array) $fields as $field) {
         $new_key = $copy_keys ? $field->field_key : '';
         if ($copy_keys && substr($field->field_key, -1) == 2) {
             $new_key = rtrim($new_key, 2);
         }
         $values = array();
         FrmFieldsHelper::fill_field($values, $field, $form_id, $new_key);
         // If this is a repeating section, create new form
         if (self::is_repeating_field($field)) {
             // create the repeatable form
             $new_repeat_form_id = apply_filters('frm_create_repeat_form', 0, array('parent_form_id' => $form_id, 'field_name' => $field->name));
             // Save old form_select
             $old_repeat_form_id = $field->field_options['form_select'];
             // Update form_select for repeating field
             $values['field_options']['form_select'] = $new_repeat_form_id;
         }
         // If this is a field inside of a repeating section, associate it with the correct form
         if ($field->form_id != $old_form_id && isset($old_repeat_form_id) && isset($new_repeat_form_id) && $field->form_id == $old_repeat_form_id) {
             $values['form_id'] = $new_repeat_form_id;
         }
         $values = apply_filters('frm_duplicated_field', $values);
         $new_id = self::create($values);
         $frm_duplicate_ids[$field->id] = $new_id;
         $frm_duplicate_ids[$field->field_key] = $new_id;
         unset($field);
     }
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:31,代码来源:FrmField.php

示例2: duplicate

 public static function duplicate()
 {
     check_ajax_referer('frm_ajax', 'nonce');
     global $wpdb;
     $field_id = FrmAppHelper::get_post_param('field_id', 0, 'absint');
     $form_id = FrmAppHelper::get_post_param('form_id', 0, 'absint');
     $copy_field = FrmField::getOne($field_id);
     if (!$copy_field) {
         wp_die();
     }
     do_action('frm_duplicate_field', $copy_field, $form_id);
     do_action('frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id);
     $values = array('id' => $form_id);
     FrmFieldsHelper::fill_field($values, $copy_field, $form_id);
     $field_count = FrmDb::get_count($wpdb->prefix . 'frm_fields fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id)', array('or' => 1, 'fr.id' => $form_id, 'fr.parent_form_id' => $form_id));
     $values['field_order'] = $field_count + 1;
     if (!($field_id = FrmField::create($values))) {
         wp_die();
     }
     self::include_single_field($field_id, $values);
     wp_die();
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:22,代码来源:FrmFieldsController.php

示例3: duplicate_section

 public static function duplicate_section($section_field, $form_id)
 {
     check_ajax_referer('frm_ajax', 'nonce');
     global $wpdb;
     if (isset($_POST['children'])) {
         $children = array_filter((array) $_POST['children'], 'is_numeric');
         $fields = FrmField::getAll(array('fi.id' => $children), 'field_order');
     } else {
         $fields = array();
     }
     array_unshift($fields, $section_field);
     $field_count = FrmDb::get_count($wpdb->prefix . 'frm_fields fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id)', array('or' => 1, 'fr.id' => $form_id, 'fr.parent_form_id' => $form_id));
     $ended = false;
     if (isset($section_field->field_options['repeat']) && $section_field->field_options['repeat']) {
         // create the repeatable form
         $new_form_id = FrmProField::create_repeat_form(0, array('parent_form_id' => $form_id, 'field_name' => $section_field->name));
     } else {
         $new_form_id = $form_id;
     }
     foreach ($fields as $field) {
         // keep the current form id or give it the id of the newly created form
         $this_form_id = $field->form_id == $form_id ? $form_id : $new_form_id;
         $values = array();
         FrmFieldsHelper::fill_field($values, $field, $this_form_id);
         if (FrmField::is_repeating_field($field)) {
             $values['field_options']['form_select'] = $new_form_id;
         }
         $field_count++;
         $values['field_order'] = $field_count;
         $field_id = FrmField::create($values);
         if (!$field_id) {
             continue;
         }
         if ('end_divider' == $field->type) {
             $ended = true;
         }
         $values['id'] = $this_form_id;
         FrmFieldsController::include_single_field($field_id, $values);
     }
     if (!$ended) {
         //make sure the section is ended
         self::create_multiple_fields((array) $section_field, $form_id);
     }
     // Prevent the function in the free version from completing
     wp_die();
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:46,代码来源:FrmProFieldsController.php


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