$group_title, 'fields' => $fields, 'form' => $form ) ); } /** * Output option tab nav * @return void * @since 2.0.0-alpha2 */ function ap_options_nav() { $groups = ap_get_option_groups(); $active = (isset( $_REQUEST['option_page'] )) ? $_REQUEST['option_page'] : 'general' ; $menus = array(); $icons = array( 'general' => 'apicon-home', 'layout' => 'apicon-eye', 'pages' => 'apicon-pin', 'question' => 'apicon-question', 'users' => 'apicon-users', 'permission' => 'apicon-lock', 'moderate' => 'apicon-flag', 'roles' => 'apicon-user', 'categories' => 'apicon-category', 'tags' => 'apicon-tag', 'labels' => 'apicon-tag', ); foreach ( (array) $groups as $k => $args ) { $link = admin_url( "admin.php?page=anspress_options&option_page={$k}" ); $icon = isset( $icons[ $k ] ) ? esc_attr( $icons[ $k ] ) : 'apicon-gear'; $menus[ $k ] = array( 'title' => $args['title'], 'link' => $link, 'icon' => $icon ); } /** * Filter is applied before showing option tab navigation * @var array * @since 2.0.0 */ $menus = apply_filters( 'ap_option_tab_nav', $menus ); $o = '
'; echo $o; } /** * Display fields group options. Uses AnsPress_Form to renders fields. * @return void * @since 2.0.0 */ function ap_option_group_fields() { $groups = ap_get_option_groups(); $active = ap_sanitize_unslash( 'option_page', 'request', 'general' ); if ( empty( $groups ) && is_array( $groups ) ) { return; } $fields = $groups[ $active ]['fields']; $fields[] = array( 'name' => 'fields_group', 'type' => 'hidden', 'value' => $active, ); if ( isset( $groups[ $active ]['form'] ) && false !== $groups[ $active ]['form'] ) { $args = array( 'name' => 'options_form', 'is_ajaxified' => false, 'submit_button' => __( 'Save options', 'anspress-question-answer' ), 'nonce_name' => 'nonce_option_form', 'fields' => $fields, 'show_reset' => true, ); $form = new AnsPress_Form( $args ); echo '