Skip to content

Commit f37f155

Browse files
committed
Allow custom visual placeholder
1 parent 201723c commit f37f155

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

config/titelive-client.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
],
1717
],
1818
],
19+
'book_visual_placeholder_url' => asset('/img/book-placeholder.png'),
1920
];

src/Book.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public function canBeOrdered(): bool
6464
&& ($this->hasStock() || $this->availability == BookAvailability::AvailableOnDemand);
6565
}
6666

67-
public function visual(string $size): string
67+
public function visual(string $size, ?string $placeholder = null): ?string
6868
{
69-
$url = $this->visuals[$size];
69+
$url = $this->visuals[$size] ?? null;
7070

7171
if (preg_match('/no_image\.png/', $url)) {
72-
return asset('/img/book-placeholder.png');
72+
return $placeholder ?? config('titelive-client.book_visual_placeholder_url');
7373
}
7474

7575
return $url;

0 commit comments

Comments
 (0)