add_section( array( 'id' => 'general', 'label' => esc_html__( 'General', 'easy-digital-downloads' ), 'callback' => array( $this, 'section_general' ) ) ); } elseif ( count( $sections ) ) { foreach ( $sections as $section ) { $this->add_section( $section ); } } } /** * Setup the sections for the current item * * @since 3.0 * * @param object $item */ public function set_item( $item = false ) { $this->item = $item; } /** * Output the contents * * @since 3.0 */ public function display() { $use_js = ! empty( $this->use_js ) ? ' use-js' : ''; $role = $this->use_js ? 'tablist' : 'menu'; ob_start(); ?>
get_all_section_contents(); ?>

nonce_field(); if ( ! empty( $this->item ) ) : ?>
sections[] = (object) wp_parse_args( $section, array( 'id' => '', 'label' => '', 'icon' => 'admin-settings', 'callback' => '' ) ); } /** * Is a section the current section? * * @since 3.0 * * @param string $section_id * * @return bool */ private function is_current_section( $section_id = '' ) { return ( $section_id === $this->current_section ); } /** * Output the nonce field for the meta box * * @since 3.0 */ protected function nonce_field() { wp_nonce_field( 'edd_' . $this->id . '_sections_nonce', 'edd_' . $this->id . 'nonce_sections', true ); } /** * Get all section links * * @since 3.0 * * @return string */ protected function get_all_section_links() { ob_start(); // Loop through sections foreach ( $this->sections as $section ) : $url = $this->use_js ? '#' . esc_attr( $this->id . $section->id ) : add_query_arg( 'view', sanitize_key( $section->id ), $this->base_url ); // Special selected section $selected = ! $this->use_js && $this->is_current_section( $section->id ) ? 'aria-current="true"' : ''; $class = $this->is_current_section( $section->id ) ? 'section-title section-title--is-active' : 'section-title'; $aria_attributes = $this->use_js ? 'role="tab" aria-controls="' . esc_attr( $this->id . $section->id ) . '"' : 'role="menuitem"'; ?>
  • > label; // Allow HTML ?>
  • use_js ) ? wp_filter_object_list( $this->sections, array( 'id' => $this->current_section ) ) : $this->sections; // Bail if no sections if ( empty( $sections ) ) { return; } // Loop through sections foreach ( $sections as $section ) : // Special selected section $selected = ! $this->is_current_section( $section->id ) ? 'style="display: none;"' : ''; ?>
    >callback ) ) { if ( is_callable( $section->callback ) ) { call_user_func( $section->callback, $this->item ); } elseif ( is_array( $section->callback ) && is_callable( $section->callback[0] ) ) { isset( $section->callback[1] ) ? call_user_func_array( $section->callback[0], $section->callback[1] ) : call_user_func_array( $section->callback[0], array() ); } else { _e( 'Invalid section', 'easy-digital-downloads' ); } } else { die; do_action( 'edd_' . $section->id . 'section_contents', $this ); } ?>