monsterinsights_multicheck_callback

Multicheck Callback.

Description

monsterinsights_multicheck_callback( (array) $args ); 

Renders multiple checkboxes.

Parameters (1)

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

Usage

  1. if ( !function_exists( 'monsterinsights_multicheck_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_multicheck_callback($args); 
  9.  

Defined (1)

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

/includes/admin/settings/settings-api.php  
  1. function monsterinsights_multicheck_callback( $args ) { 
  2. $monsterinsights_option = monsterinsights_get_option( $args['id'] ); 
  3.  
  4. $class = monsterinsights_sanitize_html_class( $args['field_class'] ); 
  5.  
  6. $html = ''; 
  7. if ( ! empty( $args['options'] ) ) { 
  8. foreach( $args['options'] as $key => $option ): 
  9. if( isset( $monsterinsights_option[ $key ] ) ) { $enabled = $option; } else { $enabled = NULL; } 
  10. $html .= '<input name="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" id="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']" class="' . $class . '" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked($option, $enabled, false) . '/> '; 
  11. $html .= '<label for="monsterinsights_settings[' . monsterinsights_sanitize_key( $args['id'] ) . '][' . monsterinsights_sanitize_key( $key ) . ']">' . wp_kses_post( $option ) . '</label><br/>'; 
  12. endforeach; 
  13. $html .= '<p class="description">' . $args['desc'] . '</p>'; 
  14.  
  15. return apply_filters( 'monsterinsights_after_setting_output', $html, $args );