$el_id // HTML ID of element
, 'name' => $el_id
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5.
, 'style' => '' // CSS of select element
, 'class' => '' // CSS Class of select element
, 'disabled' => false
, 'attr' => array() // Any additional attributes, if this radio | checkbox element
, 'legend' => '' // aria-label parameter
, 'value' => $el_value // Some Value from optins array that selected by default
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code
, 'hint' => array( 'title' => __('Send email notification to customer about this operation' ,'booking') , 'position' => 'top' )
);
wpbc_flex_toggle( $params_checkbox );
}
/**
* Show Resource selection choosen in Timeline View.
*
* @return void
*/
function wpbc_ui__timeline__resource_selection() {
if ( ! class_exists( 'wpdev_bk_personal' ) ) {
return;
}
wpbc_ui__choosen__resource_selection();
$bk_admin_url = wpbc_get_params_in_url( wpbc_get_bookings_url( false ), array( 'wh_booking_type' ) );
$bk_admin_url .= '&wh_booking_type=';
?>
id;
}
$selector_arr = array();
if ( count( $all_ids ) > 1 ) {
$selector_arr[ __( 'All resources', 'booking' ) ] = implode( ',', $all_ids );
}
foreach ( $resources_arr as $resource_obj ) {
$resource_title = $resource_obj->title;
if ( ( isset( $resource_obj->parent ) ) && ( intval( $resource_obj->parent ) !== 0 ) ) {
$resource_title = ' ' . $resource_title;
}
$selector_arr[ $resource_title ] = $resource_obj->id;
}
$selector_id = 'wh_booking_type';
$text_empty_selection = __( 'Booking resources', 'booking' );
wpbc_ui__choosen( $selector_id, $selector_arr, $text_empty_selection );
}
/**
* R e s o u r c e s S e l e c t o r [C H O O S E N].
*
* @param string $selector_id - 'wh_booking_type' - HTML ID of element.
* @param array $selector_arr - array( 'Title' => Value ).
* @param string $text_empty_selection - 'Booking resources'.
*/
function wpbc_ui__choosen( $selector_id, $selector_arr, $text_empty_selection ) {
$wpdevbk_value = '';
$wpdevbk_value_array = array();
if ( isset( $_REQUEST[ $selector_id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
$wpdevbk_value = sanitize_text_field( wp_unslash( $_REQUEST[ $selector_id ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
if ( strpos( $wpdevbk_value, ',' ) !== false ) {
$wpdevbk_value_array = explode( ',', $wpdevbk_value );
}
}
$wpdevbk_selector_default = array_search( $wpdevbk_value, $selector_arr, true );
if ( false === $wpdevbk_selector_default ) {
$wpdevbk_selector_default = current( $selector_arr );
}
?>