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


PHP FrmField::is_repeating_field方法代码示例

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


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

示例1: _check_imported_repeating_fields

 function _check_imported_repeating_fields($f, &$fields_tested)
 {
     if (!FrmField::is_repeating_field($f)) {
         return;
     }
     $fields_tested++;
     self::_check_form_select($f, 'rep_sec_form');
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:8,代码来源:test_FrmXMLHelper.php

示例2: _check_if_form_select_updates

 function _check_if_form_select_updates($old_form_id, $new_form_id)
 {
     // Get all repeating sections in both forms
     $old_repeating_sections = FrmField::get_all_types_in_form($old_form_id, 'divider');
     $new_repeating_sections = FrmField::get_all_types_in_form($new_form_id, 'divider');
     if (!$old_repeating_sections) {
         return;
     }
     foreach ($old_repeating_sections as $key => $section) {
         if (!FrmField::is_repeating_field($section)) {
             continue;
         }
         $old_form_select = $section->field_options['form_select'];
         $new_form_select = $new_repeating_sections[$key]->field_options['form_select'];
         $this->assertNotEquals($old_form_select, $new_form_select, 'A form was duplicated, but the form_select was not updated for the repeating section :/');
     }
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:17,代码来源:test_FrmForm.php

示例3: test_toggle_repeat

 /**
  * @covers FrmProFieldsController::toggle_repeat
  */
 function test_toggle_repeat()
 {
     /*
     1. Start with repeating, switch to regular
     	- move child fields to parent form √
     	- move child entries to parent form √
     	- child entries deleted √
     	- child form deleted √
     	- form_select and repeat updated √
     	- check if correct form_id is echoed √
     
     2. Switch to repeating
     	- child form created w/correct parent_form_id √
     	- move child fields to child form √
     	- child entries created from parent data √
     	- form_select updated and repeat updated √
     	- check if correct form_id is echoed
     */
     $form_id = $this->factory->form->get_id_by_key('all_field_types');
     $section_fields = FrmField::get_all_types_in_form($form_id, 'divider');
     foreach ($section_fields as $section) {
         if (FrmField::is_repeating_field($section)) {
             $repeating_section = $section;
             break;
         }
     }
     $child_form_id = $repeating_section->field_options['form_select'];
     $children = FrmField::get_all_for_form($child_form_id, '', 'include');
     $child_ids = array();
     foreach ($children as $child) {
         $child_ids[] = $child->id;
     }
     $this->assertNotEmpty($child_ids, 'There were no fields retrieved for the repeating section form');
     self::_switch_to_not_repeating($repeating_section, $child_ids);
     self::_switch_to_repeating($repeating_section, $child_ids);
     // TODO: Again, but update the form this time
     // Update form
     /*self::_switch_to_not_repeating( $repeating_section, $child_ids );
     		// Update form
     		self::_switch_to_repeating( $repeating_section, $child_ids );
     		// Update form*/
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:45,代码来源:test_FrmProFieldsControllerAjax.php

示例4: _e

            <li><a href="javascript:void(0)" class="frmkeys"><?php 
_e('Keys', 'formidable');
?>
</a></li>
        </ul>
        <ul class="alignleft"><li><?php 
_e('Fields from your form', 'formidable');
?>
:</li></ul>
        <ul class="frm_code_list frm_full_width">
        <?php 
if (!empty($fields)) {
    global $wpdb;
    $linked_forms[] = array();
    foreach ($fields as $f) {
        if (FrmField::is_repeating_field($f)) {
            $repeat_field = $f->id;
        }
        if (FrmField::is_no_save_field($f->type)) {
            continue;
        }
        if ($f->type == 'data' && (!isset($f->field_options['data_type']) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '')) {
            continue;
        }
        FrmAppHelper::insert_opt_html(array('id' => $f->id, 'key' => $f->field_key, 'name' => $f->name, 'type' => $f->type));
        if ($f->type == 'data') {
            //get all fields from linked form
            if (isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select'])) {
                $linked_form = FrmDb::get_var($wpdb->prefix . 'frm_fields', array('id' => $f->field_options['form_select']), 'form_id');
                if (!in_array($linked_form, $linked_forms)) {
                    $linked_forms[] = $linked_form;
开发者ID:tshdvs,项目名称:GooseMobile,代码行数:31,代码来源:mb_adv_info.php

示例5: is_repeating_field

 public static function is_repeating_field($field)
 {
     _deprecated_function(__FUNCTION__, '2.0.09', 'FrmField::is_repeating_field');
     return FrmField::is_repeating_field($field);
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:5,代码来源:FrmProFieldsHelper.php

示例6: migrate_to_29

 /**
  * Switch repeating section forms to published and give them names
  */
 private static function migrate_to_29()
 {
     // Get all section fields
     $dividers = FrmField::getAll(array('fi.type' => 'divider'));
     // Update the form name and status for repeating sections
     foreach ($dividers as $d) {
         if (!FrmField::is_repeating_field($d)) {
             continue;
         }
         $form_id = $d->field_options['form_select'];
         $new_name = $d->name;
         if ($form_id && is_numeric($form_id)) {
             FrmForm::update($form_id, array('name' => $new_name, 'status' => 'published'));
         }
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:19,代码来源:FrmProDb.php

示例7: validate

 public static function validate($errors, $field, $value, $args)
 {
     $field->temp_id = $args['id'];
     // Keep current value for "Other" fields because it is needed for correct validation
     if (!$args['other']) {
         FrmEntriesHelper::get_posted_value($field, $value, $args);
     }
     if ($field->type == 'form' || FrmField::is_repeating_field($field)) {
         self::validate_embedded_form($errors, $field, $args['exclude']);
     } else {
         if ($field->type == 'user_id') {
             // make sure we have a user ID
             if (!is_numeric($value)) {
                 $value = FrmAppHelper::get_user_id_param($value);
                 FrmEntriesHelper::set_posted_value($field, $value, $args);
             }
             //add user id to post variables to be saved with entry
             $_POST['frm_user_id'] = $value;
         } else {
             if ($field->type == 'time' && is_array($value)) {
                 $value = $value['H'] . ':' . $value['m'] . (isset($value['A']) ? ' ' . $value['A'] : '');
                 FrmEntriesHelper::set_posted_value($field, $value, $args);
             }
         }
     }
     // don't validate if going backwards
     if (FrmProFormsHelper::going_to_prev($field->form_id)) {
         return array();
     }
     // clear any existing errors if draft
     if (FrmProFormsHelper::saving_draft() && isset($errors['field' . $field->temp_id])) {
         unset($errors['field' . $field->temp_id]);
     }
     self::validate_file_upload($errors, $field, $args);
     // if saving draft, only check file type since it won't be checked later
     // and confirmation field since the confirmation field value is not saved
     if (FrmProFormsHelper::saving_draft()) {
         //Check confirmation field if saving a draft
         self::validate_confirmation_field($errors, $field, $value, $args);
         return $errors;
     }
     self::validate_no_input_fields($errors, $field);
     if (empty($args['parent_field_id']) && !isset($_POST['item_meta'][$field->id])) {
         return $errors;
     }
     if (($field->type != 'tag' && $value == 0 || $field->type == 'tag' && $value == '') && isset($field->field_options['post_field']) && $field->field_options['post_field'] == 'post_category' && $field->required == '1') {
         $frm_settings = FrmAppHelper::get_settings();
         $errors['field' . $field->temp_id] = !isset($field->field_options['blank']) || $field->field_options['blank'] == '' || $field->field_options['blank'] == 'Untitled cannot be blank' ? $frm_settings->blank_msg : $field->field_options['blank'];
     }
     //Don't require fields hidden with shortcode fields="25,26,27"
     global $frm_vars;
     if (self::is_field_hidden_by_shortcode($field, $errors)) {
         unset($errors['field' . $field->temp_id]);
         $value = '';
     }
     //Don't require a conditionally hidden field
     self::validate_conditional_field($errors, $field, $value);
     //Don't require a field hidden in a conditional page or section heading
     self::validate_child_conditional_field($errors, $field, $value);
     //make sure the [auto_id] is still unique
     self::validate_auto_id($field, $value);
     //check uniqueness
     self::validate_unique_field($errors, $field, $value);
     self::set_post_fields($field, $value, $errors);
     if (!FrmProFieldsHelper::is_field_visible_to_user($field)) {
         //don't validate admin only fields that can't be seen
         unset($errors['field' . $field->temp_id]);
         FrmEntriesHelper::set_posted_value($field, $value, $args);
         return $errors;
     }
     self::validate_confirmation_field($errors, $field, $value, $args);
     //Don't validate the format if field is blank
     if (FrmAppHelper::is_empty_value($value)) {
         FrmEntriesHelper::set_posted_value($field, $value, $args);
         return $errors;
     }
     if (!is_array($value)) {
         $value = trim($value);
     }
     $validate_fields = array('number', 'phone', 'date');
     if (in_array($field->type, $validate_fields)) {
         $function = 'validate_' . $field->type . '_field';
         self::$function($errors, $field, $value);
     }
     FrmEntriesHelper::set_posted_value($field, $value, $args);
     return $errors;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:87,代码来源:FrmProEntryMeta.php

示例8: update_repeating_form_name

 /**
  *
  * Update the repeating form name when a repeating section name is updated
  *
  * @since 2.0.12
  *
  * @param array $atts
  */
 public static function update_repeating_form_name($atts)
 {
     $field = FrmField::getOne($atts['id']);
     if (FrmField::is_repeating_field($field)) {
         // Update the repeating form name
         FrmForm::update($field->field_options['form_select'], array('name' => $atts['value']));
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:16,代码来源:FrmProFieldsController.php

示例9: get_repeating_field_metas

 /**
  * Get the new child IDs for a repeating field's meta_value
  *
  * @since 2.0.16
  * @param array $meta_value
  * @param object $field
  * @param array $saved_entries
  * @return array $meta_value
  */
 private static function get_repeating_field_metas($meta_value, $field, $saved_entries)
 {
     if (FrmField::is_repeating_field($field)) {
         $new_meta_value = array();
         foreach ((array) $meta_value as $old_child_id) {
             if (isset($saved_entries[$old_child_id])) {
                 $new_meta_value[] = $saved_entries[$old_child_id];
             }
         }
         $meta_value = $new_meta_value;
     }
     return $meta_value;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:22,代码来源:FrmProXMLHelper.php

示例10: has_repeat_field

 /**
  * @since 2.0
  * @return array of repeatable section fields
  */
 public static function has_repeat_field($form_id, $single = true)
 {
     $fields = self::has_field('divider', $form_id, $single);
     if (!$fields) {
         return $fields;
     }
     $repeat_fields = array();
     foreach ($fields as $field) {
         if (FrmField::is_repeating_field($field)) {
             $repeat_fields[] = $field;
         }
     }
     return $repeat_fields;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:18,代码来源:FrmProFormsHelper.php

示例11: save_sub_entries

 public static function save_sub_entries($values, $action = 'create')
 {
     $form_id = isset($values['form_id']) ? (int) $values['form_id'] : 0;
     if (!$form_id || !isset($values['item_meta'])) {
         return $values;
     }
     $form_fields = FrmProFormsHelper::has_field('form', $form_id, false);
     $section_fields = FrmProFormsHelper::has_field('divider', $form_id, false);
     if (!$form_fields && !$section_fields) {
         // only continue if there could be sub entries
         return $values;
     }
     $form_fields = array_merge($section_fields, $form_fields);
     $new_values = $values;
     unset($new_values['item_meta']);
     // allow for multiple embeded forms
     foreach ($form_fields as $field) {
         if (!isset($values['item_meta'][$field->id]) || !isset($field->field_options['form_select']) || !isset($values['item_meta'][$field->id]['form'])) {
             // don't continue if we don't know which form to insert the sub entries into
             unset($values['item_meta'][$field->id]);
             continue;
         }
         if ('divider' == $field->type && !FrmField::is_repeating_field($field)) {
             // only create sub entries for repeatable sections
             continue;
         }
         $field_values = $values['item_meta'][$field->id];
         $sub_form_id = $field->field_options['form_select'];
         unset($field_values['form']);
         if ($action != 'create' && isset($field_values['id'])) {
             $old_ids = FrmEntryMeta::get_entry_meta_by_field($values['id'], $field->id);
             $old_ids = array_filter((array) $old_ids, 'is_numeric');
             unset($field_values['id']);
         } else {
             $old_ids = array();
         }
         $sub_ids = array();
         foreach ($field_values as $k => $v) {
             $entry_values = $new_values;
             $entry_values['form_id'] = $sub_form_id;
             $entry_values['item_meta'] = (array) $v;
             $entry_values['parent_item_id'] = isset($values['id']) ? $values['id'] : 0;
             $entry_values['parent_form_id'] = $form_id;
             // include a nonce just to be sure the parent_form_id is legit
             $entry_values['parent_nonce'] = wp_create_nonce('parent');
             // set values for later user (file upload and tags fields)
             $_POST['item_meta']['key_pointer'] = $k;
             $_POST['item_meta']['parent_field'] = $field->id;
             if (!is_numeric($k) && in_array(str_replace('i', '', $k), $old_ids)) {
                 // update existing sub entries
                 $entry_values['id'] = str_replace('i', '', $k);
                 FrmEntry::update($entry_values['id'], $entry_values);
                 $sub_id = $entry_values['id'];
             } else {
                 // create new sub entries
                 $sub_id = FrmEntry::create($entry_values);
             }
             if ($sub_id) {
                 $sub_ids[] = $sub_id;
             }
             unset($k, $v, $entry_values, $sub_id);
         }
         $values['item_meta'][$field->id] = $sub_ids;
         // array of sub entry ids
         $old_ids = array_diff($old_ids, $sub_ids);
         if (!empty($old_ids)) {
             // delete entries that were removed from section
             foreach ($old_ids as $old_id) {
                 FrmEntry::destroy($old_id);
             }
         }
         unset($field);
     }
     return $values;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:75,代码来源:FrmProEntry.php

示例12: get_children

 /**
  * Return all the field IDs for the fields inside of a section (not necessarily repeating) or an embedded form
  *
  * @since 2.0.13
  * @param array $field
  * @return array $children
  */
 public static function get_children($field)
 {
     global $wpdb;
     $children = array();
     // If repeating field or embedded form
     if (FrmField::is_repeating_field($field) || $field['type'] == 'form') {
         $repeat_id = isset($field['form_select']) ? $field['form_select'] : $field['field_options']['form_select'];
         $children = FrmDb::get_col($wpdb->prefix . 'frm_fields', array('form_id' => $repeat_id));
     } else {
         $end_divider_order = FrmDb::get_var($wpdb->prefix . 'frm_fields', array('form_id' => $field['form_id'], 'type' => 'end_divider', 'field_order>' => $field['field_order']), 'field_order', array('order_by' => 'field_order ASC'), 1);
         $min_field_order = $field['field_order'] + 1;
         $max_field_order = $end_divider_order - 1;
         $children = FrmDb::get_col($wpdb->prefix . 'frm_fields', array('form_id' => $field['form_id'], 'field_order>' => $min_field_order, 'field_order<' => $max_field_order));
     }
     return $children;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:23,代码来源:FrmProField.php


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