/** * FIELDS - Display Categories output options */ function wpshop_display_cat_sheet_output() { $wpshop_display_option = get_option('wpshop_display_option'); $field_identifier = 'wpshop_display_cat_sheet_output'; if (current_user_can('wpshop_edit_options')) { $content = array('category_description', 'category_subcategory', 'category_subproduct'); $option_field_output = ''; foreach ($content as $content_definition) { $current_value = is_array($wpshop_display_option['wpshop_display_cat_sheet_output']) && in_array($content_definition, $wpshop_display_option['wpshop_display_cat_sheet_output']) || !is_array($wpshop_display_option['wpshop_display_cat_sheet_output']) ? $content_definition : ''; switch ($content_definition) { case 'category_description': $field_label = __('Display product category description', 'wpshop'); break; case 'category_subcategory': $field_label = __('Display sub categories listing', 'wpshop'); break; case 'category_subproduct': $field_label = __('Display products listing', 'wpshop'); break; default: $field_label = __('Nothing defined here', 'wpshop'); break; } $option_field_output .= wpshop_form::form_input_check('wpshop_display_option[' . $field_identifier . '][]', $field_identifier . '_' . $content_definition, $content_definition, $current_value, 'checkbox') . '<label for="' . $field_identifier . '_' . $content_definition . '" >' . $field_label . '</label><br/>'; } } else { $option_field_output = $wpshop_display_option[$field_identifier]; } echo $option_field_output; }