| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions |
| 4 |
* |
| 5 |
* @package GamiPress\WeForms\Functions |
| 6 |
* @since 1.0.0 |
| 7 |
*/ |
| 8 |
// Exit if accessed directly |
| 9 |
if( !defined( 'ABSPATH' ) ) exit; |
| 10 |
|
| 11 |
/** |
| 12 |
* Get form fields values |
| 13 |
* |
| 14 |
* @since 1.0.0 |
| 15 |
* |
| 16 |
* @param array $fields |
| 17 |
* |
| 18 |
* @return array |
| 19 |
*/ |
| 20 |
function gamipress_weforms_get_form_field_values( $form, $entry_id ) { |
| 21 |
|
| 22 |
$form_fields = array(); |
| 23 |
|
| 24 |
$obj_form = new weForms_Form($form); |
| 25 |
$obj_entry = new weForms_Form_Entry($entry_id, $obj_form); |
| 26 |
$name_fields = $obj_entry->get_form( $entry_id )->get_field_values(); |
| 27 |
|
| 28 |
// Loop all fields |
| 29 |
foreach ( $name_fields as $field_name => $value ) { |
| 30 |
$field_value = weforms_get_entry_meta( $entry_id, $field_name, true ); |
| 31 |
$form_fields[$field_name] = $field_value; |
| 32 |
} |
| 33 |
|
| 34 |
if( function_exists( 'automatorwp_utilities_pull_array_values' ) ) { |
| 35 |
$form_fields = automatorwp_utilities_pull_array_values( $form_fields ); |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
return $form_fields; |
| 40 |
} |