';
echo '';
// For field with additional options / sub-fields, we add a wrapper to enclose field descriptions
if ( array_key_exists( 'field_options_wrapper', $args ) && $args['field_options_wrapper'] ) {
// For when the options / sub-fields occupy lengthy vertical space, we add show all / less toggler
if ( array_key_exists( 'field_options_moreless', $args ) && $args['field_options_moreless'] ) {
echo '
';
// For field with additional options / sub-fields, we add wrapper for them
if ( array_key_exists( 'field_options_wrapper', $args ) && $args['field_options_wrapper'] ) {
echo '';
}
// For field with additional options / sub-fields, we add a wrapper to enclose field descriptions
if ( array_key_exists( 'field_options_wrapper', $args ) && $args['field_options_wrapper'] ) {
echo '
';
echo '
';
}
}
/**
* Render checkbox field as sub-field of a toggle/switcher checkbox
*
* @since 1.9.0
*/
function render_checkbox_plain( $args ) {
$option_name = $args['option_name'];
if ( !empty( $option_name ) ) {
$options = get_option( $option_name, array() );
} else {
$options = get_option( ASENHA_SLUG_U, array() );
}
$field_name = $args['field_name'];
$field_label = $args['field_label'];
$default_value = false;
switch ( $args['field_id'] ) {
case 'login_page_disable_registration':
$default_value = ( 1 == get_option( 'users_can_register' ) ? false : true );
break;
}
$field_option_value = ( isset( $options[$args['field_id']] ) ? $options[$args['field_id']] : $default_value );
echo '';
echo '';
}
/**
* Render checkbox field as sub-field of a toggle/switcher checkbox
*
* @since 1.3.0
*/
function render_checkbox_subfield( $args ) {
$option_name = $args['option_name'];
if ( !empty( $option_name ) ) {
$options = get_option( $option_name, array() );
} else {
$options = get_option( ASENHA_SLUG_U, array() );
}
$field_name = $args['field_name'];
$field_label = $args['field_label'];
if ( 'enable_duplication_for' == $args['parent_field_id'] ) {
// Default is true/enabled. Usually for options introduced at a later date where the previous default is true/enabled.
$default_value = true;
} else {
// Default is false / checked
$default_value = false;
}
$field_option_value = ( isset( $options[$args['parent_field_id']][$args['field_id']] ) ? $options[$args['parent_field_id']][$args['field_id']] : $default_value );
echo '';
echo '';
}
/**
* Render radio buttons field as sub-field of a toggle/switcher checkbox
*
* @since 1.3.0
*/
function render_radio_buttons_subfield( $args ) {
$option_name = $args['option_name'];
if ( !empty( $option_name ) ) {
$options = get_option( $option_name, array() );
} else {
$options = get_option( ASENHA_SLUG_U, array() );
}
$field_id = $args['field_id'];
$field_name = $args['field_name'];
$field_radios = $args['field_radios'];
if ( !empty( $args['field_default'] ) ) {
$default_value = $args['field_default'];
} else {
$default_value = false;
}
$field_description = ( isset( $args['field_description'] ) ? $args['field_description'] : '' );
$field_option_value = ( isset( $options[$field_id] ) ? $options[$field_id] : $default_value );
echo '
get_menu_hidden_by_toggle();
$i = 1;
// Check if there's an existing custom menu order data stored in options
if ( array_key_exists( 'custom_menu_order', $options ) ) {
$custom_menu = $options['custom_menu_order'];
$custom_menu = explode( ',', $custom_menu );
$menu_key_in_use = array();
// Render sortables with data in custom menu order
foreach ( $custom_menu as $custom_menu_item ) {
foreach ( $menu as $menu_key => $menu_info ) {
if ( false !== strpos( $menu_info[4], 'wp-menu-separator' ) ) {
$menu_item_title = $menu_info[2];
$menu_item_id = $menu_info[2];
} else {
$menu_item_title = $menu_info[0];
$menu_item_id = $menu_info[5];
}
$menu_url_fragment = '';
if ( $custom_menu_item == $menu_item_id ) {
$menu_item_id_transformed = $common_methods->transform_menu_item_id( $menu_item_id );
$is_custom_menu = 'no';
?>
strip_html_tags_and_content( $menu_item_title ) );
} else {
// Get defaul/custom menu item title
foreach ( $custom_menu_titles as $custom_menu_title ) {
// At this point, $custom_menu_title value looks like toplevel_page_snippets__Code Snippets
$custom_menu_title = explode( '__', $custom_menu_title );
if ( $custom_menu_title[0] == $menu_item_id ) {
$menu_item_title = $common_methods->strip_html_tags_and_content( $custom_menu_title[1] );
// e.g. Code Snippets
break;
// stop foreach loop so $menu_item_title is not overwritten in the next iteration
} else {
$menu_item_title = $common_methods->strip_html_tags_and_content( $menu_info[0] );
}
}
?>