monsterinsights_radio_callback

Radio Callback.

Description

monsterinsights_radio_callback( (array) $args ); 

Renders radio boxes.

Parameters (1)

0. $args (array)
Arguments passed by the setting

Usage

  1. if ( !function_exists( 'monsterinsights_radio_callback' ) ) { 
  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. $args = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = monsterinsights_radio_callback($args); 
  9.  

Defined (1)

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

/includes/admin/settings/settings-api.php  
  1. function monsterinsights_radio_callback( $args ) { 
  2. $monsterinsights_options = monsterinsights_get_option( $args['id'] ); 
  3.  
  4. $html = ''; 
  5.  
  6. $class = monsterinsights_sanitize_html_class( $args['field_class'] ); 
  7.  
  8. foreach ( $args['options'] as $key => $option ) : 
  9. $checked = false; 
  10.  
  11. if ( $monsterinsights_options && $monsterinsights_options == $key ) { 
  12. $checked = true; 
  13. } else if( isset( $args['std'] ) && $args['std'] == $key && ! $monsterinsights_options ) { 
  14. $checked = true; 
  15.  
  16. $html .= '<label for="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']">'; 
  17. $html .= '<input name="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . ']" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" class="' . $class . '" type="radio" value="' . monsterinsights_sanitize_key( $key ) . '" ' . checked(true, $checked, false) . '/> '; 
  18. $html .= esc_html( $option ) . '</label>'; 
  19. endforeach; 
  20.  
  21. $html .= '<p class="description">' . apply_filters( 'monsterinsights_after_setting_output', wp_kses_post( $args['desc'] ), $args ) . '</p>'; 
  22.  
  23. return $html;