Merge pull request #1675 from IanDelMar/search-widget
Fix search block widget
This commit is contained in:
commit
31d9ab6b35
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
843
css/theme.css
843
css/theme.css
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -8,6 +8,44 @@
|
|||
// Exit if accessed directly.
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( ! function_exists( 'understrap_add_block_widget_search_classes' ) ) {
|
||||
/**
|
||||
* Adds Bootstrap classes to search block widget.
|
||||
*
|
||||
* @param string $block_content The block content.
|
||||
* @param array $block The full block, including name and attributes.
|
||||
* @return string The filtered block content.
|
||||
*/
|
||||
function understrap_add_block_widget_search_classes( $block_content, $block ) {
|
||||
|
||||
$search = array(
|
||||
'wp-block-search__input ',
|
||||
'wp-block-search__input"',
|
||||
'wp-block-search__button ',
|
||||
);
|
||||
$replace = array(
|
||||
'wp-block-search__input form-control ',
|
||||
'wp-block-search__input form-control"',
|
||||
'wp-block-search__button btn btn-primary ',
|
||||
);
|
||||
|
||||
if ( isset( $block['attrs']['buttonPosition'] ) && 'button-inside' === $block['attrs']['buttonPosition'] ) {
|
||||
$search[] = 'wp-block-search__inside-wrapper';
|
||||
$replace[] = 'wp-block-search__inside-wrapper input-group';
|
||||
|
||||
if ( 'bootstrap4' === get_theme_mod( 'understrap_bootstrap_version', 'bootstrap4' ) ) {
|
||||
$search[] = '<button';
|
||||
$search[] = '</button>';
|
||||
$replace[] = '<div class="input-group-append"><button';
|
||||
$replace[] = '</button></div>';
|
||||
}
|
||||
}
|
||||
|
||||
return str_replace( $search, $replace, $block_content );
|
||||
}
|
||||
}
|
||||
add_filter( 'render_block_core/search', 'understrap_add_block_widget_search_classes', 10, 2 );
|
||||
|
||||
/**
|
||||
* Add filter to the parameters passed to a widget's display callback.
|
||||
* The filter is evaluated on both the front and the back end!
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): util.js
|
||||
* Bootstrap (v4.6.1): util.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -197,7 +197,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): alert.js
|
||||
* Bootstrap (v4.6.1): alert.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -206,7 +206,7 @@
|
|||
*/
|
||||
|
||||
const NAME$a = 'alert';
|
||||
const VERSION$a = '4.6.2';
|
||||
const VERSION$a = '4.6.1';
|
||||
const DATA_KEY$a = 'bs.alert';
|
||||
const EVENT_KEY$a = `.${DATA_KEY$a}`;
|
||||
const DATA_API_KEY$7 = '.data-api';
|
||||
|
|
@ -341,7 +341,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): button.js
|
||||
* Bootstrap (v4.6.1): button.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -350,7 +350,7 @@
|
|||
*/
|
||||
|
||||
const NAME$9 = 'button';
|
||||
const VERSION$9 = '4.6.2';
|
||||
const VERSION$9 = '4.6.1';
|
||||
const DATA_KEY$9 = 'bs.button';
|
||||
const EVENT_KEY$9 = `.${DATA_KEY$9}`;
|
||||
const DATA_API_KEY$6 = '.data-api';
|
||||
|
|
@ -532,7 +532,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): carousel.js
|
||||
* Bootstrap (v4.6.1): carousel.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -541,7 +541,7 @@
|
|||
*/
|
||||
|
||||
const NAME$8 = 'carousel';
|
||||
const VERSION$8 = '4.6.2';
|
||||
const VERSION$8 = '4.6.1';
|
||||
const DATA_KEY$8 = 'bs.carousel';
|
||||
const EVENT_KEY$8 = `.${DATA_KEY$8}`;
|
||||
const DATA_API_KEY$5 = '.data-api';
|
||||
|
|
@ -1092,7 +1092,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): collapse.js
|
||||
* Bootstrap (v4.6.1): collapse.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -1101,7 +1101,7 @@
|
|||
*/
|
||||
|
||||
const NAME$7 = 'collapse';
|
||||
const VERSION$7 = '4.6.2';
|
||||
const VERSION$7 = '4.6.1';
|
||||
const DATA_KEY$7 = 'bs.collapse';
|
||||
const EVENT_KEY$7 = `.${DATA_KEY$7}`;
|
||||
const DATA_API_KEY$4 = '.data-api';
|
||||
|
|
@ -4040,7 +4040,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): dropdown.js
|
||||
* Bootstrap (v4.6.1): dropdown.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -4049,7 +4049,7 @@
|
|||
*/
|
||||
|
||||
const NAME$6 = 'dropdown';
|
||||
const VERSION$6 = '4.6.2';
|
||||
const VERSION$6 = '4.6.1';
|
||||
const DATA_KEY$6 = 'bs.dropdown';
|
||||
const EVENT_KEY$6 = `.${DATA_KEY$6}`;
|
||||
const DATA_API_KEY$3 = '.data-api';
|
||||
|
|
@ -4537,7 +4537,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): modal.js
|
||||
* Bootstrap (v4.6.1): modal.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -4546,7 +4546,7 @@
|
|||
*/
|
||||
|
||||
const NAME$5 = 'modal';
|
||||
const VERSION$5 = '4.6.2';
|
||||
const VERSION$5 = '4.6.1';
|
||||
const DATA_KEY$5 = 'bs.modal';
|
||||
const EVENT_KEY$5 = `.${DATA_KEY$5}`;
|
||||
const DATA_API_KEY$2 = '.data-api';
|
||||
|
|
@ -5115,7 +5115,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): tools/sanitizer.js
|
||||
* Bootstrap (v4.6.1): tools/sanitizer.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -5229,7 +5229,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): tooltip.js
|
||||
* Bootstrap (v4.6.1): tooltip.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -5238,7 +5238,7 @@
|
|||
*/
|
||||
|
||||
const NAME$4 = 'tooltip';
|
||||
const VERSION$4 = '4.6.2';
|
||||
const VERSION$4 = '4.6.1';
|
||||
const DATA_KEY$4 = 'bs.tooltip';
|
||||
const EVENT_KEY$4 = `.${DATA_KEY$4}`;
|
||||
const JQUERY_NO_CONFLICT$4 = $__default["default"].fn[NAME$4];
|
||||
|
|
@ -5921,7 +5921,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): popover.js
|
||||
* Bootstrap (v4.6.1): popover.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -5930,7 +5930,7 @@
|
|||
*/
|
||||
|
||||
const NAME$3 = 'popover';
|
||||
const VERSION$3 = '4.6.2';
|
||||
const VERSION$3 = '4.6.1';
|
||||
const DATA_KEY$3 = 'bs.popover';
|
||||
const EVENT_KEY$3 = `.${DATA_KEY$3}`;
|
||||
const JQUERY_NO_CONFLICT$3 = $__default["default"].fn[NAME$3];
|
||||
|
|
@ -6080,7 +6080,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): scrollspy.js
|
||||
* Bootstrap (v4.6.1): scrollspy.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -6089,7 +6089,7 @@
|
|||
*/
|
||||
|
||||
const NAME$2 = 'scrollspy';
|
||||
const VERSION$2 = '4.6.2';
|
||||
const VERSION$2 = '4.6.1';
|
||||
const DATA_KEY$2 = 'bs.scrollspy';
|
||||
const EVENT_KEY$2 = `.${DATA_KEY$2}`;
|
||||
const DATA_API_KEY$1 = '.data-api';
|
||||
|
|
@ -6175,7 +6175,7 @@
|
|||
}
|
||||
|
||||
return null;
|
||||
}).filter(Boolean).sort((a, b) => a[0] - b[0]).forEach(item => {
|
||||
}).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
|
||||
this._offsets.push(item[0]);
|
||||
|
||||
this._targets.push(item[1]);
|
||||
|
|
@ -6349,7 +6349,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): tab.js
|
||||
* Bootstrap (v4.6.1): tab.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -6358,7 +6358,7 @@
|
|||
*/
|
||||
|
||||
const NAME$1 = 'tab';
|
||||
const VERSION$1 = '4.6.2';
|
||||
const VERSION$1 = '4.6.1';
|
||||
const DATA_KEY$1 = 'bs.tab';
|
||||
const EVENT_KEY$1 = `.${DATA_KEY$1}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
|
|
@ -6396,7 +6396,7 @@
|
|||
|
||||
|
||||
show() {
|
||||
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED) || this._element.hasAttribute('disabled')) {
|
||||
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -6567,7 +6567,7 @@
|
|||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v4.6.2): toast.js
|
||||
* Bootstrap (v4.6.1): toast.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
|
@ -6576,7 +6576,7 @@
|
|||
*/
|
||||
|
||||
const NAME = 'toast';
|
||||
const VERSION = '4.6.2';
|
||||
const VERSION = '4.6.1';
|
||||
const DATA_KEY = 'bs.toast';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4047
js/theme.js
4047
js/theme.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -85,6 +85,11 @@ parameters:
|
|||
count: 1
|
||||
path: inc/theme-settings.php
|
||||
|
||||
-
|
||||
message: "#^Function understrap_add_block_widget_search_classes\\(\\) has parameter \\$block with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: inc/widgets.php
|
||||
|
||||
-
|
||||
message: "#^Function understrap_widget_classes\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
|
@ -109,4 +114,3 @@ parameters:
|
|||
message: "#^Function understrap_quantity_input_classes\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: inc/woocommerce.php
|
||||
|
||||
|
|
|
|||
|
|
@ -170,39 +170,35 @@ a.skip-link {
|
|||
display: block;
|
||||
}
|
||||
|
||||
// New Search Widget in Block Editor
|
||||
// Search Block Widget
|
||||
.wp-block-search {
|
||||
.wp-block-search__label {
|
||||
@if variable-exists('bootstrap4') {
|
||||
@include sr-only();
|
||||
|
||||
.wp-block-search__button {
|
||||
|
||||
@if variable-exists("bootstrap4") {
|
||||
margin-left: $form-grid-gutter-width;
|
||||
} @else {
|
||||
@include visually-hidden();
|
||||
margin-left: $grid-gutter-width * 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wp-block-search__inside-wrapper {
|
||||
@extend .input-group;
|
||||
&.wp-block-search__button-inside {
|
||||
|
||||
.wp-block-search__input {
|
||||
@extend .form-control;
|
||||
}
|
||||
.wp-block-search__inside-wrapper {
|
||||
border: none;
|
||||
padding: 0;
|
||||
|
||||
.wp-block-search__button {
|
||||
border-radius: $border-radius;
|
||||
|
||||
&:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@if variable-exists('bootstrap4') {
|
||||
@include button-variant( $primary, $primary );
|
||||
border-top-left-radius: 0px;
|
||||
border-bottom-left-radius: 0px;
|
||||
} @else {
|
||||
@include button-variant( $primary, $primary );
|
||||
.wp-block-search__input {
|
||||
border-radius: $input-border-radius;
|
||||
border: $input-border-width solid $input-border-color;
|
||||
padding: $input-padding-y $input-padding-x;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wp-block-search__button {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fixing Off-canvas close icon is hidden behind admin bar
|
||||
|
|
|
|||
Loading…
Reference in New Issue