ninja_forms_serialize_form

Function that returns a serialized string containing the form for export.

Description

ninja_forms_serialize_form( $form_id ); 

Parameters (1)

0. $form_id
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_serialize_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/impexp-forms.php'; 
  3.  
  4. // The form id. 
  5. $form_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_serialize_form($form_id); 
  9.  

Defined (1)

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

/deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/impexp-forms.php  
  1. function ninja_forms_serialize_form( $form_id ) { 
  2. if ( $form_id == '' ) 
  3. return; 
  4.  
  5. $plugin_settings = nf_get_settings(); 
  6. $form_row = array(); 
  7. $form_row['data'] = Ninja_Forms()->form( $form_id )->get_all_settings(); 
  8. $field_results = ninja_forms_get_fields_by_form_id( $form_id ); 
  9. $form_row['id'] = NULL; 
  10. if ( is_array ( $form_row ) AND ! empty ( $form_row ) ) { 
  11. if ( is_array( $field_results ) AND ! empty( $field_results ) ) { 
  12. $x = 0; 
  13. foreach( $field_results as $field ) { 
  14. $form_row['field'][$x] = $field; 
  15. $x++; 
  16.  
  17. // Get all of our notifications for this form 
  18. $notifications = nf_get_notifications_by_form_id( $form_id ); 
  19. $form_row['notifications'] = $notifications; 
  20.  
  21. $form_row = apply_filters( 'nf_export_form_row', $form_row ); 
  22.  
  23. $form_row = serialize($form_row); 
  24.  
  25. return $form_row;