Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #21 from 21TORR/next
Browse files Browse the repository at this point in the history
Build catalog value on IntegrationField & Bug Fix
  • Loading branch information
apfelbox authored Dec 2, 2021
2 parents a58c141 + 293b7e0 commit 47858a7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
4.0.0-beta.5
============

* (improvement) Build `catalog` value on `IntegrationField`.
* (bug) Add check if property `kind` in `LinkField` is `image` to return `ImageValue`.


4.0.0-beta.4
============

Expand Down
5 changes: 4 additions & 1 deletion src/Structure/Field/IntegrationField.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ public function __construct (
string $label,
string $catalog,
?string $placeholder = null,
?string $catalogRepository = null,
)
{
$catalogRepository = $catalogRepository ?? $_ENV['PRISMIC_REPOSITORY'];

parent::__construct(self::TYPE_KEY, FilterFieldsHelper::filterOptionalFields([
"label" => $label,
"catalog" => $catalog,
"catalog" => "{$catalogRepository}--{$catalog}",
"placeholder" => $placeholder,
]));
}
Expand Down
3 changes: 2 additions & 1 deletion src/Structure/Field/LinkField.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function getValidationConstraints () : array
public function transformValue (mixed $data, FieldValueTransformer $valueTransformer) : mixed
{
$type = $data["link_type"] ?? null;
$kind = $data["kind"] ?? null;

if ("Web" === $type)
{
Expand All @@ -82,7 +83,7 @@ public function transformValue (mixed $data, FieldValueTransformer $valueTransfo
{
// return as an image, if specifically an image was asked for
// @todo always return it this way (and use ImageValue or FileValue)
if (self::SELECT_MEDIA === $this->select)
if ("image" === $kind)
{
return new ImageValue(
$data["url"],
Expand Down

0 comments on commit 47858a7

Please sign in to comment.