Deprecated
This function has been deprecated. Replaced by new form class instead.
ap_option_group_fields()
Description #
Display fields group options. Uses AnsPress_Form to renders fields.
Source #
File: includes/deprecated.php
function ap_option_group_fields() {
_deprecated_function( __FUNCTION__, '4.1.0' );
$groups = ap_get_option_groups();
$active = ap_sanitize_unslash( 'option_page', 'request', 'general' );
if ( empty( $groups ) && is_array( $groups ) ) {
return;
}
$group = $groups[ $active ];
foreach ( (array) $group['sections'] as $section_slug => $section ) {
$fields = $section['fields'];
if ( is_array( $fields ) ) {
$fields[] = array(
'name' => 'action',
'type' => 'hidden',
'value' => 'anspress_options',
);
$fields[] = array(
'name' => 'fields_group',
'type' => 'hidden',
'value' => $active,
);
$fields[] = array(
'name' => 'ap_active_section',
'type' => 'hidden',
'value' => $section_slug,
);
$args = array(
'name' => 'options_form',
'is_ajaxified' => false,
'submit_button' => __( 'Save options', 'anspress-question-answer' ),
'nonce_name' => 'nonce_option_form',
'fields' => $fields,
'action' => admin_url( 'admin-post.php' ),
);
$form = new AnsPress_Form( $args );
echo '<div class="postbox ' . esc_attr( $section_slug ) . '">';
echo '<h3 data-index="' . esc_attr( $section_slug ) . '"><span>' . esc_html( $section['title'] ) . '</span></h3>';
echo '<div class="inside">';
echo $form->get_form(); // xss okay.
echo '</div>';
echo '</div>';
} elseif ( function_exists( $fields ) ) {
echo '<div class="postbox ' . esc_attr( $section_slug ) . '">';
echo '<h3 data-index="' . esc_attr( $section_slug ) . '"><span>' . esc_html( $section['title'] ) . '</span></h3>';
echo '<div class="inside">';
call_user_func( $fields );
echo '</div>';
echo '</div>';
}
}
}
Expand full source code Collapse full source code View on GitHub: includes/deprecated.php:695
Add your comment