Skip to content

Commit

Permalink
Make this values instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Nov 29, 2024
1 parent 175916e commit e7e1992
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Transformers/AbstractTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(
protected ?Blueprint $blueprint = null,
protected ?Field $field = null,
protected ?array $config = null,
protected ?array $item = null,
protected ?array $values = null,
) {}

abstract public function transform(string $value);
Expand Down
2 changes: 1 addition & 1 deletion src/Transformers/AssetsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function transform(string $value): null|string|array
}

if ($alt = $this->config('alt')) {
$asset?->set('alt', Arr::get($this->item, $alt))->save();
$asset?->set('alt', Arr::get($this->values, $alt))->save();
}

return $asset?->path();
Expand Down
4 changes: 2 additions & 2 deletions tests/Transformers/AssetsTransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public function it_sets_alt_text_on_existing_asset()
'base_url' => 'https://example.com/wp-content/uploads',
'alt' => 'Image Alt Text',
],
item: [
values: [
'Image Alt Text' => 'A photo taken by someone.',
],
);
Expand Down Expand Up @@ -212,7 +212,7 @@ public function it_sets_alt_text_on_downloaded_asset()
'download_when_missing' => true,
'alt' => 'Image Alt Text',
],
item: [
values: [
'Image Alt Text' => 'A photo taken by someone.',
],
);
Expand Down

0 comments on commit e7e1992

Please sign in to comment.