diff --git a/src/Transformers/AbstractTransformer.php b/src/Transformers/AbstractTransformer.php index 7c1cc0b..d6ed85c 100644 --- a/src/Transformers/AbstractTransformer.php +++ b/src/Transformers/AbstractTransformer.php @@ -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); diff --git a/src/Transformers/AssetsTransformer.php b/src/Transformers/AssetsTransformer.php index 366c324..e81b4ee 100644 --- a/src/Transformers/AssetsTransformer.php +++ b/src/Transformers/AssetsTransformer.php @@ -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(); diff --git a/tests/Transformers/AssetsTransformerTest.php b/tests/Transformers/AssetsTransformerTest.php index e6fc071..d8e5cb1 100644 --- a/tests/Transformers/AssetsTransformerTest.php +++ b/tests/Transformers/AssetsTransformerTest.php @@ -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.', ], ); @@ -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.', ], );