Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Last active April 25, 2020 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfontjr/063296a79726e910aaf84d7f4f2bc81d to your computer and use it in GitHub Desktop.
Save vfontjr/063296a79726e910aaf84d7f4f2bc81d to your computer and use it in GitHub Desktop.
<?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;
}
<?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