Skip to content

Commit

Permalink
Refactor: ensure campaign cover block does not render unless an image…
Browse files Browse the repository at this point in the history
… is selected (#7732)
  • Loading branch information
JoshuaHungDinh authored Feb 20, 2025
1 parent 9ee4991 commit 706f15c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Campaigns/Blocks/CampaignCover/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function Edit({attributes, setAttributes, toggleSelection}: EditP
/>

)}

{hasResolved && campaign?.image &&
(!isSizeAligned ? (
<ResizableBox
Expand Down
4 changes: 2 additions & 2 deletions src/Campaigns/Blocks/CampaignCover/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use Give\Campaigns\Models\Campaign;
use Give\Campaigns\Repositories\CampaignRepository;

if ( ! isset($attributes['campaignId'])) {
if (!isset($attributes['campaignId'])) {
return;
}

/** @var Campaign $campaign */
$campaign = give(CampaignRepository::class)->getById($attributes['campaignId']);

if ( ! $campaign) {
if (!$campaign || !$campaign->image) {
return;
}

Expand Down

0 comments on commit 706f15c

Please sign in to comment.