| 1 |
<?php |
| 2 |
|
| 3 |
namespace Cookiez\Modules\Elementor\Classes; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; |
| 7 |
} |
| 8 |
|
| 9 |
use Cookiez\Classes\Utils; |
| 10 |
use Elementor\Widget_Base; |
| 11 |
|
| 12 |
class Widget_Utils { |
| 13 |
|
| 14 |
public const CONTROL_NAME = 'template_type'; |
| 15 |
|
| 16 |
private const OPT_IN = 'opt-in'; |
| 17 |
private const OPT_OUT = 'opt-out'; |
| 18 |
|
| 19 |
public static function resolve_override( Widget_Base $widget ): ?string { |
| 20 |
if ( ! Utils::is_elementor_editor() ) { |
| 21 |
return null; |
| 22 |
} |
| 23 |
|
| 24 |
$value = $widget->get_settings_for_display( self::CONTROL_NAME ); |
| 25 |
|
| 26 |
return ( self::OPT_IN === $value || self::OPT_OUT === $value ) ? $value : null; |
| 27 |
} |
| 28 |
} |
| 29 |
|