Skip to content

Commit a1205d0

Browse files
authored
Merge pull request #118 from elgentos/add-boolean-dom-class
Add Boolean class to use with Prismic boolean type
2 parents 123b909 + f0d1cfa commit a1205d0

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Block/AbstractBlock.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function replaceRelativeUrl(string $context): string
8080
/**
8181
* Fetch document view
8282
*
83-
* @return string
83+
* @return string|bool
8484
*/
85-
abstract public function fetchDocumentView(): string;
85+
abstract public function fetchDocumentView(): string | bool;
8686
}

src/Block/Dom/Boolean.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Elgentos\PrismicIO\Block\Dom;
4+
5+
use Elgentos\PrismicIO\Block\AbstractBlock;
6+
7+
class Boolean extends AbstractBlock
8+
{
9+
public function fetchDocumentView(): bool
10+
{
11+
return (bool) $this->getContext();
12+
}
13+
}

0 commit comments

Comments
 (0)