Skip to content

Commit

Permalink
Query Loop: Fix isControlAllowed and isTemplate combined logic (#65984)
Browse files Browse the repository at this point in the history
* Fix isControlAllowed and isTemplate logic

* Remove isTemplate check when inherit is already being checked

Co-authored-by: mikachan <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
Co-authored-by: ndiego <[email protected]>
Co-authored-by: daviedR <[email protected]>
  • Loading branch information
6 people authored Oct 12, 2024
1 parent b6c9a42 commit ad6e130
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,18 @@ export default function QueryInspectorControls( props ) {
const showInheritControl =
isTemplate && isControlAllowed( allowedControls, 'inherit' );
const showPostTypeControl =
( ! inherit && isControlAllowed( allowedControls, 'postType' ) ) ||
! isTemplate;
! inherit && isControlAllowed( allowedControls, 'postType' );
const postTypeControlLabel = __( 'Post type' );
const postTypeControlHelp = __(
'Select the type of content to display: posts, pages, or custom post types.'
);
const showColumnsControl = false;
const showOrderControl =
( ! inherit && isControlAllowed( allowedControls, 'order' ) ) ||
! isTemplate;
! inherit && isControlAllowed( allowedControls, 'order' );
const showStickyControl =
( ! inherit &&
showSticky &&
isControlAllowed( allowedControls, 'sticky' ) ) ||
( showSticky && ! isTemplate );
! inherit &&
showSticky &&
isControlAllowed( allowedControls, 'sticky' );
const showSettingsPanel =
showInheritControl ||
showPostTypeControl ||
Expand Down

0 comments on commit ad6e130

Please sign in to comment.