本文整理汇总了PHP中FrmField::get_all_types_in_form方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmField::get_all_types_in_form方法的具体用法?PHP FrmField::get_all_types_in_form怎么用?PHP FrmField::get_all_types_in_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmField
的用法示例。
在下文中一共展示了FrmField::get_all_types_in_form方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_all_field_types_for_form_key
function get_all_field_types_for_form_key($form_key, $expected_field_num, $type)
{
$form_id = $this->factory->form->get_id_by_key($form_key);
$fields = FrmField::get_all_types_in_form($form_id, $type);
$actual_field_num = count($fields);
$this->assertEquals($actual_field_num, $expected_field_num, $actual_field_num . ' ' . $type . ' fields were retrieved for ' . $form_key . ' form, but ' . $expected_field_num . ' were expected. This could mean that certain fields were not imported correctly.');
return $fields;
}
示例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 :/');
}
}
示例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*/
}
示例4: _get_the_join_field
function _get_the_join_field(&$args)
{
$linked_field = FrmField::getOne($args['field']->field_options['form_select']);
$join_fields = FrmField::get_all_types_in_form($linked_field->form_id, 'data');
foreach ($join_fields as $j) {
if ($j->field_options['form_select'] == $args['parent_field']->field_options['form_select']) {
$args['join_field'] = $j;
break;
}
}
}
示例5: create_post_entry
public static function create_post_entry($id = false, $post_id = false)
{
if (FrmAppHelper::doing_ajax()) {
check_ajax_referer('frm_ajax', 'nonce');
}
if (!$id) {
$id = (int) $_POST['id'];
}
if (!$post_id) {
$post_id = (int) $_POST['post_id'];
}
if (!is_numeric($id) || !is_numeric($post_id)) {
return;
}
$post = get_post($post_id);
global $wpdb;
$values = array('description' => __('Copied from Post', 'formidable'), 'form_id' => $id, 'created_at' => $post->post_date_gmt, 'name' => $post->post_title, 'item_key' => FrmAppHelper::get_unique_key($post->post_name, $wpdb->prefix . 'frm_items', 'item_key'), 'user_id' => $post->post_author, 'post_id' => $post->ID);
$results = $wpdb->insert($wpdb->prefix . 'frm_items', $values);
unset($values);
if (!$results) {
wp_die();
}
$entry_id = $wpdb->insert_id;
$user_id_field = FrmField::get_all_types_in_form($id, 'user_id', 1);
if ($user_id_field) {
$new_values = array('meta_value' => $post->post_author, 'item_id' => $entry_id, 'field_id' => $user_id_field->id, 'created_at' => current_time('mysql', 1));
$wpdb->insert($wpdb->prefix . 'frm_item_metas', $new_values);
}
$display = FrmProDisplay::get_auto_custom_display(array('form_id' => $id, 'entry_id' => $entry_id));
if ($display) {
update_post_meta($post->ID, 'frm_display_id', $display->ID);
}
wp_die();
}
示例6: has_field
public static function has_field($type, $form_id, $single = true)
{
global $wpdb;
if ($single) {
$included = FrmDb::get_var('frm_fields', array('form_id' => $form_id, 'type' => $type));
if ($included) {
$included = FrmField::getOne($included);
}
} else {
$included = FrmField::get_all_types_in_form($form_id, $type);
}
return $included;
}
示例7: get_issuer_id
/**
* Get issuer ID.
*
* @see https://github.com/wp-pay-extensions/gravityforms/blob/1.4.2/src/PaymentData.php#L336-L358
* @return string
*/
public function get_issuer_id()
{
$bank = null;
$bank_fields = FrmField::get_all_types_in_form($this->form_id, 'pronamic_bank_select');
$bank_field = reset($bank_fields);
if ($bank_field) {
if (isset($this->entry->metas[$bank_field->id])) {
$bank = $this->entry->metas[$bank_field->id];
}
}
return $bank;
}
示例8: meta_through_join
public static function meta_through_join($hide_field, $selected_field, $observed_field_val, $this_field = false, &$metas)
{
if (is_array($observed_field_val)) {
$observed_field_val = array_filter($observed_field_val);
}
if (empty($observed_field_val) || !is_numeric($observed_field_val) && !is_array($observed_field_val)) {
return;
}
$observed_info = FrmField::getOne($hide_field);
if (!$selected_field || !$observed_info) {
return;
}
$form_id = FrmProFieldsHelper::get_parent_form_id($selected_field);
$join_fields = FrmField::get_all_types_in_form($form_id, 'data');
if (empty($join_fields)) {
return;
}
foreach ($join_fields as $jf) {
if (isset($jf->field_options['form_select']) && isset($observed_info->field_options['form_select']) && $jf->field_options['form_select'] == $observed_info->field_options['form_select']) {
$join_field = $jf->id;
}
}
if (!isset($join_field)) {
return;
}
$observed_field_val = array_filter((array) $observed_field_val);
$query = array('field_id' => (int) $join_field);
$sub_query = array('it.meta_value' => $observed_field_val);
foreach ($observed_field_val as $obs_val) {
$sub_query['or'] = 1;
$sub_query['it.meta_value LIKE'] = ':"' . $obs_val . '"';
}
$query[] = $sub_query;
$user_id = '';
if ($this_field && isset($this_field->field_options['restrict']) && $this_field->field_options['restrict']) {
$query['e.user_id'] = get_current_user_id();
}
// the ids of all the entries that have been selected in the linked form
$entry_ids = FrmEntryMeta::getEntryIds($query);
if (!empty($entry_ids)) {
if ($form_id != $selected_field->form_id) {
// this is a child field so we need to get the child entries
global $wpdb;
$entry_ids = FrmDb::get_col($wpdb->prefix . 'frm_items', array('parent_item_id' => $entry_ids));
}
if (!empty($entry_ids)) {
$metas = FrmEntryMeta::getAll(array('item_id' => $entry_ids, 'field_id' => $selected_field->id), ' ORDER BY meta_value');
}
}
}
示例9: validate
public static function validate($errors, $values)
{
/*
if (isset($values['item_meta'])){
foreach( $values['item_meta'] as $key => $value ) {
$field = FrmField::getOne($key);
if ($field && $field->type == 'hidden' and empty($value))
$errors[] = __( 'Hidden fields must have a value.', 'formidable' );
}
}
*/
// add a user id field if the form requires one
if (isset($values['logged_in']) || isset($values['editable']) || isset($values['single_entry']) && isset($values['options']['single_entry_type']) && $values['options']['single_entry_type'] == 'user' || isset($values['options']['save_draft']) && $values['options']['save_draft'] == 1) {
$form_id = $values['id'];
$user_field = FrmField::get_all_types_in_form($form_id, 'user_id', 1);
if (!$user_field) {
$new_values = FrmFieldsHelper::setup_new_vars('user_id', $form_id);
$new_values['name'] = __('User ID', 'formidable');
FrmField::create($new_values);
}
}
if (isset($values['options']['auto_responder'])) {
if (!isset($values['options']['ar_email_message']) || $values['options']['ar_email_message'] == '') {
$errors[] = __('Please insert a message for your auto responder.', 'formidable');
}
if (isset($values['options']['ar_reply_to']) && !is_email(trim($values['options']['ar_reply_to']))) {
$errors[] = __('That is not a valid reply-to email address for your auto responder.', 'formidable');
}
}
return $errors;
}