| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Core\Kits\Documents\Tabs; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Core\Kits\Documents\Kit; |
| 7 |
use Elementor\Core\Kits\Manager; |
| 8 |
use Elementor\Plugin; |
| 9 |
use Elementor\Settings; |
| 10 |
use Elementor\Sub_Controls_Stack; |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; // Exit if accessed directly |
| 14 |
} |
| 15 |
|
| 16 |
abstract class Tab_Base extends Sub_Controls_Stack { |
| 17 |
/** |
| 18 |
* @var Kit |
| 19 |
*/ |
| 20 |
protected $parent; |
| 21 |
|
| 22 |
abstract protected function register_tab_controls(); |
| 23 |
|
| 24 |
public function register_controls() { |
| 25 |
$this->register_tab(); |
| 26 |
|
| 27 |
$this->register_tab_controls(); |
| 28 |
} |
| 29 |
|
| 30 |
public function on_save( $data ) {} |
| 31 |
|
| 32 |
protected function register_tab() { |
| 33 |
Controls_Manager::add_tab( $this->get_id(), $this->get_title() ); |
| 34 |
} |
| 35 |
|
| 36 |
protected function add_default_globals_notice() { |
| 37 |
// Get the current section config (array - section id and tab) to use for creating a unique control ID and name |
| 38 |
$current_section = $this->parent->get_current_section(); |
| 39 |
|
| 40 |
/** @var Manager $module */ |
| 41 |
$kits_manager = Plugin::$instance->kits_manager; |
| 42 |
|
| 43 |
if ( $kits_manager->is_custom_colors_enabled() || $kits_manager->is_custom_typography_enabled() ) { |
| 44 |
$this->add_control( |
| 45 |
$current_section['section'] . '_schemes_notice', |
| 46 |
[ |
| 47 |
'name' => $current_section['section'] . '_schemes_notice', |
| 48 |
'type' => Controls_Manager::RAW_HTML, |
| 49 |
'raw' => sprintf( __( 'In order for Theme Style to affect all relevant Elementor elements, please disable Default Colors and Fonts from the <a href="%s" target="_blank">Settings Page</a>.', 'elementor' ), Settings::get_url() ), |
| 50 |
'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', |
| 51 |
'render_type' => 'ui', |
| 52 |
] |
| 53 |
); |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
|