| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\AtomicWidgets\Styles\Transformers; |
| 4 |
|
| 5 |
use Elementor\Modules\AtomicWidgets\Base\Style_Transformer_Base; |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; // Exit if accessed directly. |
| 9 |
} |
| 10 |
|
| 11 |
class Array_Transformer extends Style_Transformer_Base { |
| 12 |
|
| 13 |
public static function type(): string { |
| 14 |
return 'array'; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* @param array{array: array<int, mixed>, delimiter: ?string} $value |
| 19 |
* @param callable $transform |
| 20 |
* @return string |
| 21 |
*/ |
| 22 |
public function transform( $value, callable $transform ): string { |
| 23 |
$array = $value['array']; |
| 24 |
$delimiter = $value['delimiter'] ?? ' '; |
| 25 |
|
| 26 |
return implode( (string) $delimiter, array_map( $transform, $array ) ); |
| 27 |
} |
| 28 |
} |
| 29 |
|