Skip to content

Commit

Permalink
- update AcfFieldTypeSettingsBlock to return a default card when Fiel…
Browse files Browse the repository at this point in the history
…dTypeSettings have not been configured for a field type
  • Loading branch information
jasonbahl committed Dec 20, 2023
1 parent f182b43 commit dd8beb7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion wp-blocks/AcfFieldTypeSettingsBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ export function AcfFieldTypeSettingsBlock({ fieldTypeSettingsBlockFields }) {
}
};


if ( ! fieldTypeSettings?.nodes?.length ) {
return (
<Card>
<CardHeader className="grid grid-cols-[1fr_110px] items-start space-y-2">
Field Type Settings not yet configured for this field type
</CardHeader>
</Card>
);
}

return (
<>
<Card>
Expand Down Expand Up @@ -77,7 +88,7 @@ export function AcfFieldTypeSettingsBlock({ fieldTypeSettingsBlockFields }) {
<CardFooter>
<div className="flex justify-center items-center space-x-4 w-full">
<Button variant="ghost" onClick={toggleAll} className="w-full">
{openItems.length === fieldTypeSettings.nodes.length ? 'Collapse All' : 'Expand All'}
{openItems.length === fieldTypeSettings?.nodes?.length ? 'Collapse All' : 'Expand All'}
</Button>
</div>
</CardFooter>
Expand Down

0 comments on commit dd8beb7

Please sign in to comment.