Skip to content

Commit

Permalink
Rename parameters in useHasImageSettingsPanel hook
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiomorales committed Sep 19, 2023
1 parent c61a43c commit 87b06ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
} from '@wordpress/components';
import { __, _x } from '@wordpress/i18n';

export function useHasImageSettingsPanel( name, settings, userSettings ) {
// Note: If lightbox userSettings exists, that means
// they were defined via the Global Styles UI and
// will NOT be a boolean value or contain the `allowEditing`
// property, so we should show the settings panel in those cases.
export function useHasImageSettingsPanel( name, value, inheritedValue ) {
// Note: If lightbox `value` exists, that means it was
// defined via the the Global Styles UI and will NOT
// be a boolean value or contain the `allowEditing` property,
// so we should show the settings panel in those cases.
return (
( name === 'core/image' && settings?.lightbox?.allowEditing ) ||
!! userSettings?.lightbox
( name === 'core/image' && inheritedValue?.lightbox?.allowEditing ) ||
!! value?.lightbox
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function ScreenBlock( { name, variation } ) {
const hasFiltersPanel = useHasFiltersPanel( settings );
const hasImageSettingsPanel = useHasImageSettingsPanel(
name,
settings,
userSettings
userSettings,
settings
);
const hasVariationsPanel = !! blockVariations?.length && ! variation;
const { canEditCSS } = useSelect( ( select ) => {
Expand Down

0 comments on commit 87b06ef

Please sign in to comment.