2 ) $file_paths[] = 'jqueryui/datepicker-i18n/jquery.ui.datepicker-' . substr( $locale, 0, 2 ) . '.js'; $deps = array( 'jquery-ui-datepicker' ); foreach ( $file_paths as $file_path ) { if ( file_exists( RWMB_DIR . 'js/' . $file_path ) ) { wp_register_script( 'jquery-ui-datepicker-i18n', RWMB_JS_URL . $file_path, $deps, '1.8.17', true ); $deps[] = 'jquery-ui-datepicker-i18n'; break; } } wp_enqueue_script( 'rwmb-date', RWMB_JS_URL . 'date.js', $deps, RWMB_VER, true ); wp_localize_script( 'rwmb-date', 'RWMB_Datepicker', array( 'lang' => $locale ) ); } /** * Get field HTML * * @param mixed $meta * @param array $field * * @return string */ static function html( $meta, $field ) { return sprintf( '', $field['field_name'], $meta, isset( $field['clone'] ) && $field['clone'] ? '' : $field['id'], $field['size'], esc_attr( json_encode( $field['js_options'] ) ) ); } /** * Normalize parameters for field * * @param array $field * * @return array */ static function normalize_field( $field ) { $field = wp_parse_args( $field, array( 'size' => 30, 'js_options' => array(), ) ); // Deprecate 'format', but keep it for backward compatible // Use 'js_options' instead $field['js_options'] = wp_parse_args( $field['js_options'], array( 'dateFormat' => empty( $field['format'] ) ? 'yy-mm-dd' : $field['format'], 'showButtonPanel' => true, ) ); return $field; } } }