um_admin_add_conditional_support

The Ultimate Member um admin add conditional support function.

Description

um_admin_add_conditional_support( $form_id, $field_args, $in_edit, $edit_array ); 

Parameters (4)

0. $form_id
The form id.
1. $field_args
The field args.
2. $in_edit
The in edit.
3. $edit_array
The edit array.

Usage

  1. if ( !function_exists( 'um_admin_add_conditional_support' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ultimate-member/admin/core/um-admin-actions-modal.php'; 
  3.  
  4. // The form id. 
  5. $form_id = null; 
  6.  
  7. // The field args. 
  8. $field_args = null; 
  9.  
  10. // The in edit. 
  11. $in_edit = null; 
  12.  
  13. // The edit array. 
  14. $edit_array = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = um_admin_add_conditional_support($form_id, $field_args, $in_edit, $edit_array); 
  18.  

Defined (1)

The function is defined in the following location(s).

/admin/core/um-admin-actions-modal.php  
  1. function um_admin_add_conditional_support( $form_id, $field_args, $in_edit, $edit_array ) { 
  2. $metabox = new UM_Admin_Metabox(); 
  3.  
  4. if ( isset($field_args['conditional_support']) && $field_args['conditional_support'] == 0 ) return; 
  5.  
  6. ?> 
  7.  
  8. <div class="um-admin-btn-toggle"> 
  9.  
  10. <?php if ( $in_edit ) { $metabox->in_edit = true; $metabox->edit_array = $edit_array; ?> 
  11. <a href="#"><i class="um-icon-plus"></i><?php _e('Manage conditional fields support'); ?></a> <?php $metabox->tooltip('Here you can setup conditional logic to show/hide this field based on specific fields value or conditions'); ?> 
  12. <?php } else { ?> 
  13. <a href="#"><i class="um-icon-plus"></i><?php _e('Add conditional fields support'); ?></a> <?php $metabox->tooltip('Here you can setup conditional logic to show/hide this field based on specific fields value or conditions'); ?> 
  14. <?php } ?> 
  15.  
  16. <div class="um-admin-btn-content"> 
  17.  
  18. <p class="um-admin-reset-conditions"><a href="#" class="button button-primary"><?php _e('Reset all rules', 'ultimatemember'); ?></a></p> 
  19. <div class="um-admin-clear"></div> 
  20.  
  21. <?php 
  22.  
  23. if ( isset( $edit_array['conditions'] ) ) { 
  24.  
  25. foreach( $edit_array['conditions'] as $k => $arr ) { 
  26.  
  27. if ( $k == 0 ) $k = ''; 
  28. ?> 
  29.  
  30. <div class="um-admin-cur-condition"> 
  31.  
  32. <?php $metabox->field_input( '_conditional_action' . $k, $form_id ); ?> 
  33. <?php $metabox->field_input( '_conditional_field' . $k , $form_id ); ?> 
  34. <?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?> 
  35. <?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?> 
  36.  
  37. <?php if ( $k == '' ) { ?> 
  38. <p><a href="#" class="um-admin-new-condition button um-admin-tipsy-n" title="Add new condition"><i class="um-icon-plus" style="margin-right:0!important"></i></a></p> 
  39. <?php } else { ?> 
  40. <p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p> 
  41. <?php } ?> 
  42.  
  43. <div class="um-admin-clear"></div> 
  44. </div> 
  45.  
  46. <?php 
  47.  
  48.  
  49. } else { 
  50.  
  51. ?> 
  52.  
  53. <div class="um-admin-cur-condition"> 
  54.  
  55. <?php $metabox->field_input( '_conditional_action', $form_id ); ?> 
  56. <?php $metabox->field_input( '_conditional_field', $form_id ); ?> 
  57. <?php $metabox->field_input( '_conditional_operator', $form_id ); ?> 
  58. <?php $metabox->field_input( '_conditional_value', $form_id ); ?> 
  59.  
  60. <p><a href="#" class="um-admin-new-condition button um-admin-tipsy-n" title="Add new condition"><i class="um-icon-plus" style="margin-right:0!important"></i></a></p> 
  61.  
  62. <div class="um-admin-clear"></div> 
  63. </div> 
  64.  
  65. <?php } ?> 
  66.  
  67. </div> 
  68.  
  69. </div> 
  70.  
  71. <?php 
  72.