-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display wide widgets as popovers in Customizer (#31736)
- Loading branch information
1 parent
29c3626
commit 4af1b88
Showing
7 changed files
with
108 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
*/ | ||
import './move-to-sidebar'; | ||
import './replace-media-upload'; | ||
import './wide-widget-display'; |
26 changes: 26 additions & 0 deletions
26
packages/customize-widgets/src/filters/wide-widget-display.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createHigherOrderComponent } from '@wordpress/compose'; | ||
import { addFilter } from '@wordpress/hooks'; | ||
|
||
const { wp } = window; | ||
|
||
const withWideWidgetDisplay = createHigherOrderComponent( | ||
( BlockEdit ) => ( props ) => { | ||
const { idBase } = props.attributes; | ||
const isWide = | ||
wp.customize.Widgets.data.availableWidgets.find( | ||
( widget ) => widget.id_base === idBase | ||
)?.is_wide ?? false; | ||
|
||
return <BlockEdit { ...props } isWide={ isWide } />; | ||
}, | ||
'withWideWidgetDisplay' | ||
); | ||
|
||
addFilter( | ||
'editor.BlockEdit', | ||
'core/customize-widgets/wide-widget-display', | ||
withWideWidgetDisplay | ||
); |