| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Home\Transformations\Base; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly. |
| 6 |
} |
| 7 |
|
| 8 |
use Elementor\Core\Isolation\Elementor_Adapter; |
| 9 |
use Elementor\Core\Isolation\Elementor_Adapter_Interface; |
| 10 |
use Elementor\Core\Isolation\Plugin_Status_Adapter; |
| 11 |
use Elementor\Core\Isolation\Plugin_Status_Adapter_Interface; |
| 12 |
use Elementor\Core\Isolation\Wordpress_Adapter; |
| 13 |
use Elementor\Core\Isolation\Wordpress_Adapter_Interface; |
| 14 |
|
| 15 |
abstract class Transformations_Abstract { |
| 16 |
|
| 17 |
protected Wordpress_Adapter_Interface $wordpress_adapter; |
| 18 |
protected Plugin_Status_Adapter_Interface $plugin_status_adapter; |
| 19 |
protected Elementor_Adapter_Interface $elementor_adapter; |
| 20 |
|
| 21 |
/** |
| 22 |
* @param $args ?array{ |
| 23 |
* wordpress_adapter: Wordpress_Adapter_Interface, |
| 24 |
* plugin_status_adapter: Plugin_Status_Adapter_Interface, |
| 25 |
* elementor_adapter: Elementor_Adapter_Interface, |
| 26 |
* } the adapters to use in the transformations |
| 27 |
*/ |
| 28 |
public function __construct( array $args = [] ) { |
| 29 |
$this->wordpress_adapter = $args['wordpress_adapter'] ?? new Wordpress_Adapter(); |
| 30 |
$this->plugin_status_adapter = $args['plugin_status_adapter'] ?? new Plugin_Status_Adapter( $this->wordpress_adapter ); |
| 31 |
$this->elementor_adapter = $args['elementor_adapter'] ?? new Elementor_Adapter(); |
| 32 |
} |
| 33 |
|
| 34 |
protected function get_tier() { |
| 35 |
$tier = $this->elementor_adapter->get_tier(); |
| 36 |
|
| 37 |
return apply_filters( 'elementor/admin/homescreen_promotion_tier', $tier ) ?? $tier; |
| 38 |
} |
| 39 |
|
| 40 |
abstract public function transform( array $home_screen_data ): array; |
| 41 |
} |
| 42 |
|