documents
4 years ago
dynamic-tags
1 year ago
query-control
2 years ago
settings
1 year ago
theme-builder
1 year ago
column.php
1 year ago
common.php
6 months ago
container.php
1 year ago
section.php
1 year ago
templates-types-manager.php
3 years ago
section.php
191 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Modules; |
| 3 | |
| 4 | use Elementor\Controls_Manager; |
| 5 | use Elementor\Group_Control_Background; |
| 6 | |
| 7 | |
| 8 | class Section { |
| 9 | |
| 10 | /** |
| 11 | * Instance of this class. |
| 12 | * |
| 13 | * @var object |
| 14 | */ |
| 15 | protected static $instance = null; |
| 16 | |
| 17 | |
| 18 | public function __construct(){ |
| 19 | // Modify section render |
| 20 | // add_action( 'elementor/frontend/section/before_render', array( $this, 'modify_render' ) ); |
| 21 | |
| 22 | // Add new controls |
| 23 | add_action( 'elementor/element/after_section_end', array( $this, 'add_pseudo_background_controls' ), 20, 3 ); |
| 24 | |
| 25 | // Go pro notice for inner container options |
| 26 | add_action( 'elementor/element/section/section_typo/after_section_end' , array( $this, 'add_inner_container_notice' ), 90 ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Return an instance of this class. |
| 31 | * |
| 32 | * @return object A single instance of this class. |
| 33 | */ |
| 34 | public static function get_instance() { |
| 35 | // If the single instance hasn't been set, set it now. |
| 36 | if ( null == self::$instance ) { |
| 37 | self::$instance = new self; |
| 38 | } |
| 39 | |
| 40 | return self::$instance; |
| 41 | } |
| 42 | |
| 43 | |
| 44 | /** |
| 45 | * Modify the render of section element |
| 46 | * |
| 47 | * @param Element_Section $section Instance of Section element |
| 48 | * |
| 49 | * @return void |
| 50 | */ |
| 51 | public function modify_render( $section ){ |
| 52 | |
| 53 | } |
| 54 | |
| 55 | |
| 56 | /** |
| 57 | * Add extra controls to section element |
| 58 | * |
| 59 | * @param Element_Section $section Instance of Section element |
| 60 | * |
| 61 | * @return void |
| 62 | */ |
| 63 | public function add_controls( $section ){ |
| 64 | |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Add option for styling the inner container |
| 69 | * |
| 70 | * @return void |
| 71 | */ |
| 72 | public function add_inner_container_notice( $widget ){ |
| 73 | |
| 74 | if( defined('THEME_PRO') && THEME_PRO ){ |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | $widget->start_controls_section( |
| 79 | 'aux_pro_inner_container_notice', |
| 80 | array( |
| 81 | 'label' => __( 'Box Container', 'auxin-elements' ), |
| 82 | 'tab' => Controls_Manager::TAB_STYLE |
| 83 | ) |
| 84 | ); |
| 85 | |
| 86 | $widget->add_control( |
| 87 | 'inner_container_go_pro_notice', |
| 88 | array( |
| 89 | 'type' => Controls_Manager::RAW_HTML, |
| 90 | 'content_classes' => 'elementor-descriptor', |
| 91 | 'raw' => '<div class="auxin-elementor-panel-notice">' . |
| 92 | '<i class="auxin-elementor-upgrade-notice-icon eicon-favorite" aria-hidden="true"></i> |
| 93 | <div class="auxin-elementor-panel-notice-title">' . |
| 94 | __( 'Parallax Effect', 'auxin-elements' ) . |
| 95 | '</div> |
| 96 | <div class="auxin-elementor-panel-notice-message">' . |
| 97 | __( 'Container options lets you add border, box shadow and background to box container.', 'auxin-elements' ) . |
| 98 | '</div> |
| 99 | <div class="auxin-elementor-panel-notice-message">' . |
| 100 | __( 'This feature is only available on Phlox Pro.', 'auxin-elements' ) . |
| 101 | '</div> |
| 102 | <a class="auxin-elementor-panel-notice-link elementor-button elementor-button-default auxin-elementor-go-pro-link" href="http://phlox.pro/go-pro/?utm_source=elementor-panel&utm_medium=phlox-free&utm_campaign=phlox-go-pro&utm_content=inner-container" target="_blank">' . |
| 103 | __( 'Get Phlox Pro', 'auxin-elements' ) . |
| 104 | '</a> |
| 105 | </div>' |
| 106 | ) |
| 107 | ); |
| 108 | |
| 109 | $widget->end_controls_section(); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Adds controls to define background for pseudo elements |
| 114 | * |
| 115 | * @return void |
| 116 | */ |
| 117 | public function add_pseudo_background_controls( $widget, $section_id, $args ){ |
| 118 | |
| 119 | if( 'section' !== $widget->get_name() ){ |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | // Anchor element sections |
| 124 | $target_sections = array('section_custom_css'); |
| 125 | |
| 126 | if( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 127 | $target_sections[] = 'section_custom_css_pro'; |
| 128 | } |
| 129 | |
| 130 | if( ! in_array( $section_id, $target_sections ) ){ |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | $widget->start_controls_section( |
| 135 | 'aux_core_background_pseudo_section', |
| 136 | array( |
| 137 | 'label' => __( 'Pseudo Background (developers)', 'auxin-elements' ), |
| 138 | 'tab' => Controls_Manager::TAB_ADVANCED |
| 139 | ) |
| 140 | ); |
| 141 | |
| 142 | $widget->add_control( |
| 143 | 'background_pseudo_description', |
| 144 | array( |
| 145 | 'raw' => __( 'Adds background to pseudo elements like ::before and ::after selectors. (developers only)', 'auxin-elements' ), |
| 146 | 'type' => Controls_Manager::RAW_HTML, |
| 147 | 'content_classes' => 'elementor-descriptor' |
| 148 | ) |
| 149 | ); |
| 150 | |
| 151 | $widget->add_control( |
| 152 | 'background_pseudo_before_heading', |
| 153 | array( |
| 154 | 'label' => __( 'Background ::before', 'auxin-elements' ), |
| 155 | 'type' => Controls_Manager::HEADING, |
| 156 | 'separator' => 'before' |
| 157 | ) |
| 158 | ); |
| 159 | |
| 160 | $widget->add_group_control( |
| 161 | Group_Control_Background::get_type(), |
| 162 | array( |
| 163 | 'name' => 'background_pseudo_before', |
| 164 | 'types' => array( 'classic', 'gradient'), |
| 165 | 'selector' => '{{WRAPPER}} .elementor-container:before' |
| 166 | ) |
| 167 | ); |
| 168 | |
| 169 | $widget->add_control( |
| 170 | 'background_pseudo_after_heading', |
| 171 | array( |
| 172 | 'label' => __( 'Background ::after', 'auxin-elements' ), |
| 173 | 'type' => Controls_Manager::HEADING, |
| 174 | 'separator' => 'before' |
| 175 | ) |
| 176 | ); |
| 177 | |
| 178 | $widget->add_group_control( |
| 179 | Group_Control_Background::get_type(), |
| 180 | array( |
| 181 | 'name' => 'background_pseudo_after', |
| 182 | 'types' => array( 'classic', 'gradient'), |
| 183 | 'selector' => '{{WRAPPER}} > .elementor-container:after' |
| 184 | ) |
| 185 | ); |
| 186 | |
| 187 | $widget->end_controls_section(); |
| 188 | } |
| 189 | |
| 190 | } |
| 191 |