diff --git a/src/AkeneoBuilderProvider.php b/src/AkeneoBuilderProvider.php index a6f2905..08029e8 100644 --- a/src/AkeneoBuilderProvider.php +++ b/src/AkeneoBuilderProvider.php @@ -17,6 +17,7 @@ public function getFunctions(): array new WithReferenceEntitySimpleOption('withReferenceEntitySimpleOption'), new WithSimpleOption('withSimpleOption'), new WithMultipleOption('withMultipleOption'), + new WithProductValueMediaFile('withProductValueMediaFile'), ]; } } diff --git a/src/WithProductValueMediaFile.php b/src/WithProductValueMediaFile.php new file mode 100644 index 0000000..2c82c3a --- /dev/null +++ b/src/WithProductValueMediaFile.php @@ -0,0 +1,44 @@ +compile(...)->bindTo($this), + $this->evaluate(...)->bindTo($this) + ); + } + + private function compile(string $code, string $attribute, string $locale = 'null', string $scope = 'null'): string + { + return << ({$code}), + 'attribute' => ({$attribute}), + 'locale' => {$locale}, + 'scope' => {$scope}, + ]) + PHP; + } + + /** + * @return array + */ + private function evaluate(array $context, string $code, string $attribute, string $locale = 'null', string $scope = 'null'): array + { + return [ + 'identifier' => $code, + 'attribute' => $attribute, + 'locale' => $locale, + 'scope' => $scope, + ]; + } +}