Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wpf_render_crm_field_select( $setting, $meta_name, $field_id, $field_sub_id = null ) {
- echo '<select id="' . $field_id . (isset($field_sub_id) ? '-' . $field_sub_id : '') . '" class="select4-crm-field" name="' . $meta_name . '[' . $field_id . ']' . (isset($field_sub_id) ? '[' . $field_sub_id . ']' : '') . '[crm_field]" data-placeholder="Select a field">';
- echo '<option></option>';
- $crm_fields = wp_fusion()->settings->get('crm_fields');
- if(!empty( $crm_fields )) {
- foreach( $crm_fields as $group_header => $fields ) {
- // For CRMs with separate custom and built in fields
- if(is_array($fields)) {
- echo '<optgroup label="' . $group_header . '">';
- foreach($crm_fields[$group_header] as $field => $label) {
- if(is_array($label))
- $label = $label['label'];
- echo '<option ' . selected(esc_attr( $setting ), $field ) . ' value="' . $field . '">' . $label . '</option>';
- }
- echo '</optgroup>';
- } else {
- $field = $group_header;
- $label = $field;
- echo '<option ' . selected(esc_attr( $setting ), $field ) . ' value="' . $field . '">' . $label . '</option>';
- }
- }
- }
- echo '</select>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement