balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

tab-base.php (2236B)


      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 get_group() {
     25 		return 'settings';
     26 	}
     27 
     28 	public function get_icon() {
     29 		return '';
     30 	}
     31 
     32 	public function get_help_url() {
     33 		return '';
     34 	}
     35 
     36 	public function get_additional_tab_content() {
     37 		return '';
     38 	}
     39 
     40 	public function register_controls() {
     41 		$this->register_tab();
     42 
     43 		$this->register_tab_controls();
     44 	}
     45 
     46 	public function on_save( $data ) {}
     47 
     48 	/**
     49 	 * Before Save
     50 	 *
     51 	 * Allows for modifying the kit data before it is saved to the database.
     52 	 *
     53 	 * @param array $data
     54 	 * @return array
     55 	 */
     56 	public function before_save( array $data ) {
     57 		return $data;
     58 	}
     59 
     60 	protected function register_tab() {
     61 		Controls_Manager::add_tab( $this->get_id(), $this->get_title() );
     62 	}
     63 
     64 	protected function add_default_globals_notice() {
     65 		// Get the current section config (array - section id and tab) to use for creating a unique control ID and name
     66 		$current_section = $this->parent->get_current_section();
     67 
     68 		/** @var Manager $module */
     69 		$kits_manager = Plugin::$instance->kits_manager;
     70 
     71 		if ( $kits_manager->is_custom_colors_enabled() || $kits_manager->is_custom_typography_enabled() ) {
     72 			$this->add_control(
     73 				$current_section['section'] . '_schemes_notice',
     74 				[
     75 					'name' => $current_section['section'] . '_schemes_notice',
     76 					'type' => Controls_Manager::RAW_HTML,
     77 					'raw' => sprintf(
     78 						/* translators: %1$s Link open tag, %2$s: Link close tag. */
     79 						esc_html__( 'In order for Theme Style to affect all relevant Elementor elements, please disable Default Colors and Fonts from the %1$sSettings Page%2$s.', 'elementor' ),
     80 						'<a href="' . esc_url( Settings::get_url() ) . '" target="_blank">',
     81 						'</a>'
     82 					),
     83 					'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
     84 					'render_type' => 'ui',
     85 				]
     86 			);
     87 		}
     88 	}
     89 }