monsterinsights_render_submit_field

Render Submit Button.

Description

monsterinsights_render_submit_field( (array) $section, (string) $page = 'tracking' ); 

If there's a saveable field on the page, show save button.

Parameters (2)

0. $section (array)
Arguments passed by the setting
1. $page — Optional. (string) => 'tracking'
The page.

Usage

  1. if ( !function_exists( 'monsterinsights_render_submit_field' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/settings/settings-api.php'; 
  3.  
  4. // Arguments passed by the setting 
  5. $section = array(); 
  6.  
  7. // The page. 
  8. $page = 'tracking'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = monsterinsights_render_submit_field($section, $page); 
  12.  

Defined (1)

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

/includes/admin/settings/settings-api.php  
  1. function monsterinsights_render_submit_field( $section, $page = 'tracking' ) { 
  2. $html = ''; 
  3. if ( is_array( $settings ) && ! empty( $settings[$section] ) && is_array( $settings[$section] ) ) { 
  4. $non_setting_types = monsterinsights_get_non_setting_types(); 
  5. $submit_button = false; 
  6. foreach ( $settings[$section] as $setting ) { 
  7. if ( ! empty( $non_setting_types ) && !in_array( $setting['type'], $non_setting_types ) ) { 
  8. $submit_button = true; 
  9. break; 
  10. if ( $submit_button ) { 
  11. $html .= '<input type="hidden" name="monsterinsights_settings_tab" value="' . esc_attr( $page ). '"/>'; 
  12. $html .= '<input type="hidden" name="monsterinsights_settings_sub_tab" value="' . esc_attr( $section ) . '"/>'; 
  13. $html .= wp_nonce_field( 'monsterinsights-settings-nonce', 'monsterinsights-settings-nonce', true, false ); 
  14. $html .= get_submit_button( esc_html__( 'Save Changes', 'google-analytics-for-wordpress' ), 'primary', 'monsterinsights-settings-submit', false ); 
  15. return $html;