cf_custom_fields_form_as_metabox

Setup form in the admin.

Description

cf_custom_fields_form_as_metabox(); 

Usage

  1. if ( !function_exists( 'cf_custom_fields_form_as_metabox' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'caldera-custom-fields/includes/metabox.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cf_custom_fields_form_as_metabox(); 
  7.  

Defined (1)

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

/includes/metabox.php  
  1. function cf_custom_fields_form_as_metabox() { 
  2. $forms = Caldera_Forms_Forms::get_forms( true ); 
  3. if(empty($forms)) { 
  4. return; 
  5. foreach($forms as $form) { 
  6. $form = Caldera_Forms_Forms::get_form( $form[ 'ID' ] ); 
  7. if( ! is_array( $form ) ) { 
  8. continue; 
  9. $processors = Caldera_Forms::get_processor_by_type('cf_asmetabox', $form); 
  10.  
  11. if(!empty( $processors )) { 
  12.  
  13. $processor = $processors[0]; 
  14.  
  15. // is metabox processor 
  16. if(!empty($form['processors'][ $processor['ID'] ]['config']['posttypes'])) { 
  17.  
  18. // add filter to get details of entry 
  19.  
  20. // add filter to remove submit buttons 
  21.  
  22. // add filter to remove file fields 
  23.  
  24. foreach( $form['processors'][ $processor['ID'] ]['config']['posttypes'] as $screen=>$enabled) { 
  25. add_meta_box( 
  26. $form['ID'],  
  27. $form['name'],  
  28. $screen,  
  29. $form['processors'][ $processor['ID'] ]['config']['context'],  
  30. $form['processors'][ $processor['ID'] ]['config']['priority'] 
  31. ); 
  32.  
  33. Caldera_Forms_Admin_Assets::admin_common(); 
  34. Caldera_Forms_Admin_Assets::form_editor(); 
  35. Caldera_Forms_Render_Assets::enqueue_all_fields(); 
  36.  
  37. // metabox & gridcss 
  38. wp_enqueue_style( 'cf-metabox-grid-styles', CCF_URL . 'css/metagrid.css'); 
  39. wp_enqueue_style( 'cf-metabox-styles', CCF_URL . 'css/metabox.css'); 
  40.