Last active
April 25, 2020 13:25
-
-
Save vfontjr/063296a79726e910aaf84d7f4f2bc81d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* add multiple fields to Formidible standard dropdowns */ | |
add_filter('frm_setup_new_fields_vars', 'customize_dfe', 25, 2); | |
function customize_dfe( $values, $field ) { | |
if( $field->id == 125 ){ //Replace 125 with the ID of your data from entries field | |
global $frm_field; | |
$values['form_select'] = 3441; | |
$field4_opts = FrmProFieldsHelper::get_linked_options( $values, $field ); | |
$values['form_select'] = 3428; | |
$field3_opts = FrmProFieldsHelper::get_linked_options( $values, $field ); | |
$values['form_select'] = 3430; | |
$field2_opts = FrmProFieldsHelper::get_linked_options( $values, $field ); | |
foreach( $values['options'] as $id => $v ) { | |
$sep2 = ($field2_opts[$id] !== null && $field2_opts[$id] !== "") ? ", " : ""; | |
$sep3 = ($field3_opts[$id] !== null && $field3_opts[$id] !== "") ? " | SSN: " : ""; | |
$sep4 = ($field4_opts[$id] !== null && $field4_opts[$id] !== "") ? " | State ID: " : ""; $values['options'][$id] .= $sep2 . $field2_opts[$id] . $sep3 . $field3_opts[$id] . $sep4 . $field4_opts[$id]; | |
} | |
} | |
return $values; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
* add multiple fields to Formidible dynamic dropdowns */ | |
add_filter('frm_setup_new_fields_vars', 'customize_dfe', 25, 2); | |
function customize_dfe( $values, $field ) { | |
if( $field->id == 125 ) { //Replace 125 with the ID of your data from entries field | |
global $frm_field; | |
$values['form_select'] = 3441; | |
$field4_opts = FrmProDynamicFieldsController::get_independent_options( $values, $field ); | |
$values['form_select'] = 3428; | |
$field3_opts = FrmProDynamicFieldsController::get_independent_options( $values, $field ); | |
$values['form_select'] = 3430; | |
$field2_opts = FrmProDynamicFieldsController::get_independent_options( $values, $field ); | |
foreach( $values['options'] as $id => $v ) { | |
$sep2 = ($field2_opts[$id] !== null && $field2_opts[$id] !== "") ? ", " : ""; | |
$sep3 = ($field3_opts[$id] !== null && $field3_opts[$id] !== "") ? " | SSN: " : ""; | |
$sep4 = ($field4_opts[$id] !== null && $field4_opts[$id] !== "") ? " | State ID: " : ""; $values['options'][$id] .= $sep2 . $field2_opts[$id] . $sep3 . $field3_opts[$id] . $sep4 . $field4_opts[$id]; | |
} | |
} | |
return $values; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment