section.php 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. <?php
  2. namespace Elementor;
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. exit; // Exit if accessed directly.
  5. }
  6. /**
  7. * Elementor section element.
  8. *
  9. * Elementor section handler class is responsible for initializing the section
  10. * element.
  11. *
  12. * @since 1.0.0
  13. */
  14. class Element_Section extends Element_Base {
  15. /**
  16. * Section edit tools.
  17. *
  18. * Holds the section edit tools.
  19. *
  20. * @since 1.0.0
  21. * @access protected
  22. * @static
  23. *
  24. * @var array Section edit tools.
  25. */
  26. protected static $_edit_tools;
  27. /**
  28. * Section predefined columns presets.
  29. *
  30. * Holds the predefined columns width for each columns count available by
  31. * default by Elementor. Default is an empty array.
  32. *
  33. * Note that when the user creates a section he can define custom sizes for
  34. * the columns. But Elementor sets default values for predefined columns.
  35. *
  36. * For example two columns 50% width each one, or three columns 33.33% each
  37. * one. This property hold the data for those preset values.
  38. *
  39. * @since 1.0.0
  40. * @access private
  41. * @static
  42. *
  43. * @var array Section presets.
  44. */
  45. private static $presets = [];
  46. /**
  47. * Get element type.
  48. *
  49. * Retrieve the element type, in this case `section`.
  50. *
  51. * @since 2.1.0
  52. * @access public
  53. * @static
  54. *
  55. * @return string The type.
  56. */
  57. public static function get_type() {
  58. return 'section';
  59. }
  60. /**
  61. * Get section name.
  62. *
  63. * Retrieve the section name.
  64. *
  65. * @since 1.0.0
  66. * @access public
  67. *
  68. * @return string Section name.
  69. */
  70. public function get_name() {
  71. return 'section';
  72. }
  73. /**
  74. * Get section title.
  75. *
  76. * Retrieve the section title.
  77. *
  78. * @since 1.0.0
  79. * @access public
  80. *
  81. * @return string Section title.
  82. */
  83. public function get_title() {
  84. return __( 'Section', 'elementor' );
  85. }
  86. /**
  87. * Get section icon.
  88. *
  89. * Retrieve the section icon.
  90. *
  91. * @since 1.0.0
  92. * @access public
  93. *
  94. * @return string Section icon.
  95. */
  96. public function get_icon() {
  97. return 'eicon-columns';
  98. }
  99. /**
  100. * Get presets.
  101. *
  102. * Retrieve a specific preset columns for a given columns count, or a list
  103. * of all the preset if no parameters passed.
  104. *
  105. * @since 1.0.0
  106. * @access public
  107. * @static
  108. *
  109. * @param int $columns_count Optional. Columns count. Default is null.
  110. * @param int $preset_index Optional. Preset index. Default is null.
  111. *
  112. * @return array Section presets.
  113. */
  114. public static function get_presets( $columns_count = null, $preset_index = null ) {
  115. if ( ! self::$presets ) {
  116. self::init_presets();
  117. }
  118. $presets = self::$presets;
  119. if ( null !== $columns_count ) {
  120. $presets = $presets[ $columns_count ];
  121. }
  122. if ( null !== $preset_index ) {
  123. $presets = $presets[ $preset_index ];
  124. }
  125. return $presets;
  126. }
  127. /**
  128. * Initialize presets.
  129. *
  130. * Initializing the section presets and set the number of columns the
  131. * section can have by default. For example a column can have two columns
  132. * 50% width each one, or three columns 33.33% each one.
  133. *
  134. * Note that Elementor sections have default section presets but the user
  135. * can set custom number of columns and define custom sizes for each column.
  136. * @since 1.0.0
  137. * @access public
  138. * @static
  139. */
  140. public static function init_presets() {
  141. $additional_presets = [
  142. 2 => [
  143. [
  144. 'preset' => [ 33, 66 ],
  145. ],
  146. [
  147. 'preset' => [ 66, 33 ],
  148. ],
  149. ],
  150. 3 => [
  151. [
  152. 'preset' => [ 25, 25, 50 ],
  153. ],
  154. [
  155. 'preset' => [ 50, 25, 25 ],
  156. ],
  157. [
  158. 'preset' => [ 25, 50, 25 ],
  159. ],
  160. [
  161. 'preset' => [ 16, 66, 16 ],
  162. ],
  163. ],
  164. ];
  165. foreach ( range( 1, 10 ) as $columns_count ) {
  166. self::$presets[ $columns_count ] = [
  167. [
  168. 'preset' => [],
  169. ],
  170. ];
  171. $preset_unit = floor( 1 / $columns_count * 100 );
  172. for ( $i = 0; $i < $columns_count; $i++ ) {
  173. self::$presets[ $columns_count ][0]['preset'][] = $preset_unit;
  174. }
  175. if ( ! empty( $additional_presets[ $columns_count ] ) ) {
  176. self::$presets[ $columns_count ] = array_merge( self::$presets[ $columns_count ], $additional_presets[ $columns_count ] );
  177. }
  178. foreach ( self::$presets[ $columns_count ] as $preset_index => & $preset ) {
  179. $preset['key'] = $columns_count . $preset_index;
  180. }
  181. }
  182. }
  183. /**
  184. * Get default edit tools.
  185. *
  186. * Retrieve the section default edit tools. Used to set initial tools.
  187. *
  188. * @since 1.0.0
  189. * @access protected
  190. * @static
  191. *
  192. * @return array Default section edit tools.
  193. */
  194. protected static function get_default_edit_tools() {
  195. $section_label = __( 'Section', 'elementor' );
  196. $edit_tools = [
  197. 'add' => [
  198. /* translators: %s: Section label */
  199. 'title' => sprintf( __( 'Add %s', 'elementor' ), $section_label ),
  200. 'icon' => 'plus',
  201. ],
  202. 'edit' => [
  203. /* translators: %s: Section label */
  204. 'title' => sprintf( __( 'Edit %s', 'elementor' ), $section_label ),
  205. 'icon' => 'handle',
  206. ],
  207. ];
  208. if ( self::is_edit_buttons_enabled() ) {
  209. $edit_tools += [
  210. 'duplicate' => [
  211. /* translators: %s: Section label */
  212. 'title' => sprintf( __( 'Duplicate %s', 'elementor' ), $section_label ),
  213. 'icon' => 'clone',
  214. ],
  215. ];
  216. }
  217. $edit_tools += [
  218. 'remove' => [
  219. /* translators: %s: Section label */
  220. 'title' => sprintf( __( 'Delete %s', 'elementor' ), $section_label ),
  221. 'icon' => 'close',
  222. ],
  223. ];
  224. return $edit_tools;
  225. }
  226. /**
  227. * Get initial config.
  228. *
  229. * Retrieve the current section initial configuration.
  230. *
  231. * Adds more configuration on top of the controls list, the tabs assigned to
  232. * the control, element name, type, icon and more. This method also adds
  233. * section presets.
  234. *
  235. * @since 1.0.10
  236. * @access protected
  237. *
  238. * @return array The initial config.
  239. */
  240. protected function _get_initial_config() {
  241. $config = parent::_get_initial_config();
  242. $config['presets'] = self::get_presets();
  243. return $config;
  244. }
  245. /**
  246. * Register section controls.
  247. *
  248. * Used to add new controls to the section element.
  249. *
  250. * @since 1.0.0
  251. * @access protected
  252. */
  253. protected function _register_controls() {
  254. $this->start_controls_section(
  255. 'section_layout',
  256. [
  257. 'label' => __( 'Layout', 'elementor' ),
  258. 'tab' => Controls_Manager::TAB_LAYOUT,
  259. ]
  260. );
  261. $this->add_control(
  262. '_title',
  263. [
  264. 'label' => __( 'Title', 'elementor' ),
  265. 'type' => Controls_Manager::HIDDEN,
  266. 'render_type' => 'none',
  267. ]
  268. );
  269. $this->add_control(
  270. 'stretch_section',
  271. [
  272. 'label' => __( 'Stretch Section', 'elementor' ),
  273. 'type' => Controls_Manager::SWITCHER,
  274. 'default' => '',
  275. 'return_value' => 'section-stretched',
  276. 'prefix_class' => 'elementor-',
  277. 'hide_in_inner' => true,
  278. 'description' => __( 'Stretch the section to the full width of the page using JS.', 'elementor' ) . sprintf( ' <a href="%1$s" target="_blank">%2$s</a>', 'https://go.elementor.com/stretch-section/', __( 'Learn more.', 'elementor' ) ),
  279. 'render_type' => 'none',
  280. 'frontend_available' => true,
  281. ]
  282. );
  283. $this->add_control(
  284. 'layout',
  285. [
  286. 'label' => __( 'Content Width', 'elementor' ),
  287. 'type' => Controls_Manager::SELECT,
  288. 'default' => 'boxed',
  289. 'options' => [
  290. 'boxed' => __( 'Boxed', 'elementor' ),
  291. 'full_width' => __( 'Full Width', 'elementor' ),
  292. ],
  293. 'prefix_class' => 'elementor-section-',
  294. ]
  295. );
  296. $this->add_control(
  297. 'content_width',
  298. [
  299. 'label' => __( 'Content Width', 'elementor' ),
  300. 'type' => Controls_Manager::SLIDER,
  301. 'range' => [
  302. 'px' => [
  303. 'min' => 500,
  304. 'max' => 1600,
  305. ],
  306. ],
  307. 'selectors' => [
  308. '{{WRAPPER}} > .elementor-container' => 'max-width: {{SIZE}}{{UNIT}};',
  309. ],
  310. 'condition' => [
  311. 'layout' => [ 'boxed' ],
  312. ],
  313. 'show_label' => false,
  314. 'separator' => 'none',
  315. ]
  316. );
  317. $this->add_control(
  318. 'gap',
  319. [
  320. 'label' => __( 'Columns Gap', 'elementor' ),
  321. 'type' => Controls_Manager::SELECT,
  322. 'default' => 'default',
  323. 'options' => [
  324. 'default' => __( 'Default', 'elementor' ),
  325. 'no' => __( 'No Gap', 'elementor' ),
  326. 'narrow' => __( 'Narrow', 'elementor' ),
  327. 'extended' => __( 'Extended', 'elementor' ),
  328. 'wide' => __( 'Wide', 'elementor' ),
  329. 'wider' => __( 'Wider', 'elementor' ),
  330. ],
  331. ]
  332. );
  333. $this->add_control(
  334. 'height',
  335. [
  336. 'label' => __( 'Height', 'elementor' ),
  337. 'type' => Controls_Manager::SELECT,
  338. 'default' => 'default',
  339. 'options' => [
  340. 'default' => __( 'Default', 'elementor' ),
  341. 'full' => __( 'Fit To Screen', 'elementor' ),
  342. 'min-height' => __( 'Min Height', 'elementor' ),
  343. ],
  344. 'prefix_class' => 'elementor-section-height-',
  345. 'hide_in_inner' => true,
  346. ]
  347. );
  348. $this->add_responsive_control(
  349. 'custom_height',
  350. [
  351. 'label' => __( 'Minimum Height', 'elementor' ),
  352. 'type' => Controls_Manager::SLIDER,
  353. 'default' => [
  354. 'size' => 400,
  355. ],
  356. 'range' => [
  357. 'px' => [
  358. 'min' => 0,
  359. 'max' => 1440,
  360. ],
  361. 'vh' => [
  362. 'min' => 0,
  363. 'max' => 100,
  364. ],
  365. ],
  366. 'size_units' => [ 'px', 'vh' ],
  367. 'selectors' => [
  368. '{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};',
  369. '{{WRAPPER}} > .elementor-container:after' => 'content: ""; min-height: inherit;', // Hack for IE11
  370. ],
  371. 'condition' => [
  372. 'height' => [ 'min-height' ],
  373. ],
  374. 'hide_in_inner' => true,
  375. ]
  376. );
  377. $this->add_control(
  378. 'height_inner',
  379. [
  380. 'label' => __( 'Height', 'elementor' ),
  381. 'type' => Controls_Manager::SELECT,
  382. 'default' => 'default',
  383. 'options' => [
  384. 'default' => __( 'Default', 'elementor' ),
  385. 'min-height' => __( 'Min Height', 'elementor' ),
  386. ],
  387. 'prefix_class' => 'elementor-section-height-',
  388. 'hide_in_top' => true,
  389. ]
  390. );
  391. $this->add_responsive_control(
  392. 'custom_height_inner',
  393. [
  394. 'label' => __( 'Minimum Height', 'elementor' ),
  395. 'type' => Controls_Manager::SLIDER,
  396. 'default' => [
  397. 'size' => 400,
  398. ],
  399. 'range' => [
  400. 'px' => [
  401. 'min' => 0,
  402. 'max' => 1440,
  403. ],
  404. ],
  405. 'selectors' => [
  406. '{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};',
  407. ],
  408. 'condition' => [
  409. 'height_inner' => [ 'min-height' ],
  410. ],
  411. 'hide_in_top' => true,
  412. ]
  413. );
  414. $this->add_control(
  415. 'column_position',
  416. [
  417. 'label' => __( 'Column Position', 'elementor' ),
  418. 'type' => Controls_Manager::SELECT,
  419. 'default' => 'middle',
  420. 'options' => [
  421. 'stretch' => __( 'Stretch', 'elementor' ),
  422. 'top' => __( 'Top', 'elementor' ),
  423. 'middle' => __( 'Middle', 'elementor' ),
  424. 'bottom' => __( 'Bottom', 'elementor' ),
  425. ],
  426. 'prefix_class' => 'elementor-section-items-',
  427. 'condition' => [
  428. 'height' => [ 'full', 'min-height' ],
  429. ],
  430. ]
  431. );
  432. $this->add_control(
  433. 'content_position',
  434. [
  435. 'label' => __( 'Content Position', 'elementor' ),
  436. 'type' => Controls_Manager::SELECT,
  437. 'default' => '',
  438. 'options' => [
  439. '' => __( 'Default', 'elementor' ),
  440. 'top' => __( 'Top', 'elementor' ),
  441. 'middle' => __( 'Middle', 'elementor' ),
  442. 'bottom' => __( 'Bottom', 'elementor' ),
  443. ],
  444. 'prefix_class' => 'elementor-section-content-',
  445. ]
  446. );
  447. $possible_tags = [
  448. 'div',
  449. 'header',
  450. 'footer',
  451. 'main',
  452. 'article',
  453. 'section',
  454. 'aside',
  455. 'nav',
  456. ];
  457. $options = [
  458. '' => __( 'Default', 'elementor' ),
  459. ] + array_combine( $possible_tags, $possible_tags );
  460. $this->add_control(
  461. 'html_tag',
  462. [
  463. 'label' => __( 'HTML Tag', 'elementor' ),
  464. 'type' => Controls_Manager::SELECT,
  465. 'options' => $options,
  466. 'separator' => 'before',
  467. ]
  468. );
  469. $this->add_control(
  470. 'structure',
  471. [
  472. 'label' => __( 'Structure', 'elementor' ),
  473. 'type' => Controls_Manager::STRUCTURE,
  474. 'default' => '10',
  475. 'render_type' => 'none',
  476. ]
  477. );
  478. $this->end_controls_section();
  479. // Section background
  480. $this->start_controls_section(
  481. 'section_background',
  482. [
  483. 'label' => __( 'Background', 'elementor' ),
  484. 'tab' => Controls_Manager::TAB_STYLE,
  485. ]
  486. );
  487. $this->start_controls_tabs( 'tabs_background' );
  488. $this->start_controls_tab(
  489. 'tab_background_normal',
  490. [
  491. 'label' => __( 'Normal', 'elementor' ),
  492. ]
  493. );
  494. $this->add_group_control(
  495. Group_Control_Background::get_type(),
  496. [
  497. 'name' => 'background',
  498. 'types' => [ 'classic', 'gradient', 'video' ],
  499. 'fields_options' => [
  500. 'background' => [
  501. 'frontend_available' => true,
  502. ],
  503. 'video_link' => [
  504. 'frontend_available' => true,
  505. ],
  506. 'video_start' => [
  507. 'frontend_available' => true,
  508. ],
  509. 'video_end' => [
  510. 'frontend_available' => true,
  511. ],
  512. ],
  513. ]
  514. );
  515. $this->end_controls_tab();
  516. $this->start_controls_tab(
  517. 'tab_background_hover',
  518. [
  519. 'label' => __( 'Hover', 'elementor' ),
  520. ]
  521. );
  522. $this->add_group_control(
  523. Group_Control_Background::get_type(),
  524. [
  525. 'name' => 'background_hover',
  526. 'selector' => '{{WRAPPER}}:hover',
  527. ]
  528. );
  529. $this->add_control(
  530. 'background_hover_transition',
  531. [
  532. 'label' => __( 'Transition Duration', 'elementor' ),
  533. 'type' => Controls_Manager::SLIDER,
  534. 'default' => [
  535. 'size' => 0.3,
  536. ],
  537. 'range' => [
  538. 'px' => [
  539. 'max' => 3,
  540. 'step' => 0.1,
  541. ],
  542. ],
  543. 'render_type' => 'ui',
  544. 'separator' => 'before',
  545. ]
  546. );
  547. $this->end_controls_tab();
  548. $this->end_controls_tabs();
  549. $this->end_controls_section();
  550. // Background Overlay
  551. $this->start_controls_section(
  552. 'section_background_overlay',
  553. [
  554. 'label' => __( 'Background Overlay', 'elementor' ),
  555. 'tab' => Controls_Manager::TAB_STYLE,
  556. 'condition' => [
  557. 'background_background' => [ 'classic', 'gradient', 'video' ],
  558. ],
  559. ]
  560. );
  561. $this->start_controls_tabs( 'tabs_background_overlay' );
  562. $this->start_controls_tab(
  563. 'tab_background_overlay_normal',
  564. [
  565. 'label' => __( 'Normal', 'elementor' ),
  566. ]
  567. );
  568. $this->add_group_control(
  569. Group_Control_Background::get_type(),
  570. [
  571. 'name' => 'background_overlay',
  572. 'selector' => '{{WRAPPER}} > .elementor-background-overlay',
  573. ]
  574. );
  575. $this->add_control(
  576. 'background_overlay_opacity',
  577. [
  578. 'label' => __( 'Opacity', 'elementor' ),
  579. 'type' => Controls_Manager::SLIDER,
  580. 'default' => [
  581. 'size' => .5,
  582. ],
  583. 'range' => [
  584. 'px' => [
  585. 'max' => 1,
  586. 'step' => 0.01,
  587. ],
  588. ],
  589. 'selectors' => [
  590. '{{WRAPPER}} > .elementor-background-overlay' => 'opacity: {{SIZE}};',
  591. ],
  592. 'condition' => [
  593. 'background_overlay_background' => [ 'classic', 'gradient' ],
  594. ],
  595. ]
  596. );
  597. $this->add_group_control(
  598. Group_Control_Css_Filter::get_type(),
  599. [
  600. 'name' => 'css_filters',
  601. 'selector' => '{{WRAPPER}} .elementor-background-overlay',
  602. ]
  603. );
  604. $this->add_control(
  605. 'overlay_blend_mode',
  606. [
  607. 'label' => __( 'Blend Mode', 'elementor' ),
  608. 'type' => Controls_Manager::SELECT,
  609. 'options' => [
  610. '' => __( 'Normal', 'elementor' ),
  611. 'multiply' => 'Multiply',
  612. 'screen' => 'Screen',
  613. 'overlay' => 'Overlay',
  614. 'darken' => 'Darken',
  615. 'lighten' => 'Lighten',
  616. 'color-dodge' => 'Color Dodge',
  617. 'saturation' => 'Saturation',
  618. 'color' => 'Color',
  619. 'luminosity' => 'Luminosity',
  620. ],
  621. 'selectors' => [
  622. '{{WRAPPER}} > .elementor-background-overlay' => 'mix-blend-mode: {{VALUE}}',
  623. ],
  624. ]
  625. );
  626. $this->end_controls_tab();
  627. $this->start_controls_tab(
  628. 'tab_background_overlay_hover',
  629. [
  630. 'label' => __( 'Hover', 'elementor' ),
  631. ]
  632. );
  633. $this->add_group_control(
  634. Group_Control_Background::get_type(),
  635. [
  636. 'name' => 'background_overlay_hover',
  637. 'selector' => '{{WRAPPER}}:hover > .elementor-background-overlay',
  638. ]
  639. );
  640. $this->add_control(
  641. 'background_overlay_hover_opacity',
  642. [
  643. 'label' => __( 'Opacity', 'elementor' ),
  644. 'type' => Controls_Manager::SLIDER,
  645. 'default' => [
  646. 'size' => .5,
  647. ],
  648. 'range' => [
  649. 'px' => [
  650. 'max' => 1,
  651. 'step' => 0.01,
  652. ],
  653. ],
  654. 'selectors' => [
  655. '{{WRAPPER}}:hover > .elementor-background-overlay' => 'opacity: {{SIZE}};',
  656. ],
  657. 'condition' => [
  658. 'background_overlay_hover_background' => [ 'classic', 'gradient' ],
  659. ],
  660. ]
  661. );
  662. $this->add_group_control(
  663. Group_Control_Css_Filter::get_type(),
  664. [
  665. 'name' => 'css_filters_hover',
  666. 'selector' => '{{WRAPPER}}:hover > .elementor-background-overlay',
  667. ]
  668. );
  669. $this->add_control(
  670. 'background_overlay_hover_transition',
  671. [
  672. 'label' => __( 'Transition Duration', 'elementor' ),
  673. 'type' => Controls_Manager::SLIDER,
  674. 'default' => [
  675. 'size' => 0.3,
  676. ],
  677. 'range' => [
  678. 'px' => [
  679. 'max' => 3,
  680. 'step' => 0.1,
  681. ],
  682. ],
  683. 'render_type' => 'ui',
  684. 'separator' => 'before',
  685. ]
  686. );
  687. $this->end_controls_tab();
  688. $this->end_controls_tabs();
  689. $this->end_controls_section();
  690. // Section border
  691. $this->start_controls_section(
  692. 'section_border',
  693. [
  694. 'label' => __( 'Border', 'elementor' ),
  695. 'tab' => Controls_Manager::TAB_STYLE,
  696. ]
  697. );
  698. $this->start_controls_tabs( 'tabs_border' );
  699. $this->start_controls_tab(
  700. 'tab_border_normal',
  701. [
  702. 'label' => __( 'Normal', 'elementor' ),
  703. ]
  704. );
  705. $this->add_group_control(
  706. Group_Control_Border::get_type(),
  707. [
  708. 'name' => 'border',
  709. ]
  710. );
  711. $this->add_control(
  712. 'border_radius',
  713. [
  714. 'label' => __( 'Border Radius', 'elementor' ),
  715. 'type' => Controls_Manager::DIMENSIONS,
  716. 'size_units' => [ 'px', '%' ],
  717. 'selectors' => [
  718. '{{WRAPPER}}, {{WRAPPER}} > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
  719. ],
  720. ]
  721. );
  722. $this->add_group_control(
  723. Group_Control_Box_Shadow::get_type(),
  724. [
  725. 'name' => 'box_shadow',
  726. ]
  727. );
  728. $this->end_controls_tab();
  729. $this->start_controls_tab(
  730. 'tab_border_hover',
  731. [
  732. 'label' => __( 'Hover', 'elementor' ),
  733. ]
  734. );
  735. $this->add_group_control(
  736. Group_Control_Border::get_type(),
  737. [
  738. 'name' => 'border_hover',
  739. 'selector' => '{{WRAPPER}}:hover',
  740. ]
  741. );
  742. $this->add_control(
  743. 'border_radius_hover',
  744. [
  745. 'label' => __( 'Border Radius', 'elementor' ),
  746. 'type' => Controls_Manager::DIMENSIONS,
  747. 'size_units' => [ 'px', '%' ],
  748. 'selectors' => [
  749. '{{WRAPPER}}:hover, {{WRAPPER}}:hover > .elementor-background-overlay' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
  750. ],
  751. ]
  752. );
  753. $this->add_group_control(
  754. Group_Control_Box_Shadow::get_type(),
  755. [
  756. 'name' => 'box_shadow_hover',
  757. 'selector' => '{{WRAPPER}}:hover',
  758. ]
  759. );
  760. $this->add_control(
  761. 'border_hover_transition',
  762. [
  763. 'label' => __( 'Transition Duration', 'elementor' ),
  764. 'type' => Controls_Manager::SLIDER,
  765. 'separator' => 'before',
  766. 'default' => [
  767. 'size' => 0.3,
  768. ],
  769. 'range' => [
  770. 'px' => [
  771. 'max' => 3,
  772. 'step' => 0.1,
  773. ],
  774. ],
  775. 'conditions' => [
  776. 'relation' => 'or',
  777. 'terms' => [
  778. [
  779. 'name' => 'background_background',
  780. 'operator' => '!==',
  781. 'value' => '',
  782. ],
  783. [
  784. 'name' => 'border_border',
  785. 'operator' => '!==',
  786. 'value' => '',
  787. ],
  788. ],
  789. ],
  790. 'selectors' => [
  791. '{{WRAPPER}}' => 'transition: background {{background_hover_transition.SIZE}}s, border {{SIZE}}s, border-radius {{SIZE}}s, box-shadow {{SIZE}}s',
  792. '{{WRAPPER}} > .elementor-background-overlay' => 'transition: background {{background_overlay_hover_transition.SIZE}}s, border-radius {{SIZE}}s, opacity {{background_overlay_hover_transition.SIZE}}s',
  793. ],
  794. ]
  795. );
  796. $this->end_controls_tab();
  797. $this->end_controls_tabs();
  798. $this->end_controls_section();
  799. // Section Shape Divider
  800. $this->start_controls_section(
  801. 'section_shape_divider',
  802. [
  803. 'label' => __( 'Shape Divider', 'elementor' ),
  804. 'tab' => Controls_Manager::TAB_STYLE,
  805. ]
  806. );
  807. $this->start_controls_tabs( 'tabs_shape_dividers' );
  808. $shapes_options = [
  809. '' => __( 'None', 'elementor' ),
  810. ];
  811. foreach ( Shapes::get_shapes() as $shape_name => $shape_props ) {
  812. $shapes_options[ $shape_name ] = $shape_props['title'];
  813. }
  814. foreach ( [
  815. 'top' => __( 'Top', 'elementor' ),
  816. 'bottom' => __( 'Bottom', 'elementor' ),
  817. ] as $side => $side_label ) {
  818. $base_control_key = "shape_divider_$side";
  819. $this->start_controls_tab(
  820. "tab_$base_control_key",
  821. [
  822. 'label' => $side_label,
  823. ]
  824. );
  825. $this->add_control(
  826. $base_control_key,
  827. [
  828. 'label' => __( 'Type', 'elementor' ),
  829. 'type' => Controls_Manager::SELECT,
  830. 'options' => $shapes_options,
  831. 'render_type' => 'none',
  832. 'frontend_available' => true,
  833. ]
  834. );
  835. $this->add_control(
  836. $base_control_key . '_color',
  837. [
  838. 'label' => __( 'Color', 'elementor' ),
  839. 'type' => Controls_Manager::COLOR,
  840. 'condition' => [
  841. "shape_divider_$side!" => '',
  842. ],
  843. 'selectors' => [
  844. "{{WRAPPER}} > .elementor-shape-$side .elementor-shape-fill" => 'fill: {{UNIT}};',
  845. ],
  846. ]
  847. );
  848. $this->add_responsive_control(
  849. $base_control_key . '_width',
  850. [
  851. 'label' => __( 'Width', 'elementor' ),
  852. 'type' => Controls_Manager::SLIDER,
  853. 'default' => [
  854. 'unit' => '%',
  855. ],
  856. 'tablet_default' => [
  857. 'unit' => '%',
  858. ],
  859. 'mobile_default' => [
  860. 'unit' => '%',
  861. ],
  862. 'range' => [
  863. '%' => [
  864. 'min' => 100,
  865. 'max' => 300,
  866. ],
  867. ],
  868. 'condition' => [
  869. "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'height_only', Shapes::FILTER_EXCLUDE ) ),
  870. ],
  871. 'selectors' => [
  872. "{{WRAPPER}} > .elementor-shape-$side svg" => 'width: calc({{SIZE}}{{UNIT}} + 1.3px)',
  873. ],
  874. ]
  875. );
  876. $this->add_responsive_control(
  877. $base_control_key . '_height',
  878. [
  879. 'label' => __( 'Height', 'elementor' ),
  880. 'type' => Controls_Manager::SLIDER,
  881. 'range' => [
  882. 'px' => [
  883. 'max' => 500,
  884. ],
  885. ],
  886. 'condition' => [
  887. "shape_divider_$side!" => '',
  888. ],
  889. 'selectors' => [
  890. "{{WRAPPER}} > .elementor-shape-$side svg" => 'height: {{SIZE}}{{UNIT}};',
  891. ],
  892. ]
  893. );
  894. $this->add_control(
  895. $base_control_key . '_flip',
  896. [
  897. 'label' => __( 'Flip', 'elementor' ),
  898. 'type' => Controls_Manager::SWITCHER,
  899. 'condition' => [
  900. "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'has_flip' ) ),
  901. ],
  902. 'selectors' => [
  903. "{{WRAPPER}} > .elementor-shape-$side svg" => 'transform: translateX(-50%) rotateY(180deg)',
  904. ],
  905. ]
  906. );
  907. $this->add_control(
  908. $base_control_key . '_negative',
  909. [
  910. 'label' => __( 'Invert', 'elementor' ),
  911. 'type' => Controls_Manager::SWITCHER,
  912. 'frontend_available' => true,
  913. 'condition' => [
  914. "shape_divider_$side" => array_keys( Shapes::filter_shapes( 'has_negative' ) ),
  915. ],
  916. 'render_type' => 'none',
  917. ]
  918. );
  919. $this->add_control(
  920. $base_control_key . '_above_content',
  921. [
  922. 'label' => __( 'Bring to Front', 'elementor' ),
  923. 'type' => Controls_Manager::SWITCHER,
  924. 'selectors' => [
  925. "{{WRAPPER}} > .elementor-shape-$side" => 'z-index: 2; pointer-events: none',
  926. ],
  927. 'condition' => [
  928. "shape_divider_$side!" => '',
  929. ],
  930. ]
  931. );
  932. $this->end_controls_tab();
  933. }
  934. $this->end_controls_tabs();
  935. $this->end_controls_section();
  936. // Section Typography
  937. $this->start_controls_section(
  938. 'section_typo',
  939. [
  940. 'label' => __( 'Typography', 'elementor' ),
  941. 'tab' => Controls_Manager::TAB_STYLE,
  942. ]
  943. );
  944. if ( in_array( Scheme_Color::get_type(), Schemes_Manager::get_enabled_schemes(), true ) ) {
  945. $this->add_control(
  946. 'colors_warning',
  947. [
  948. 'type' => Controls_Manager::RAW_HTML,
  949. 'raw' => __( 'Note: The following colors won\'t work if Default Colors are enabled.', 'elementor' ),
  950. 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
  951. ]
  952. );
  953. }
  954. $this->add_control(
  955. 'heading_color',
  956. [
  957. 'label' => __( 'Heading Color', 'elementor' ),
  958. 'type' => Controls_Manager::COLOR,
  959. 'default' => '',
  960. 'selectors' => [
  961. '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};',
  962. ],
  963. 'separator' => 'none',
  964. ]
  965. );
  966. $this->add_control(
  967. 'color_text',
  968. [
  969. 'label' => __( 'Text Color', 'elementor' ),
  970. 'type' => Controls_Manager::COLOR,
  971. 'default' => '',
  972. 'selectors' => [
  973. '{{WRAPPER}}' => 'color: {{VALUE}};',
  974. ],
  975. ]
  976. );
  977. $this->add_control(
  978. 'color_link',
  979. [
  980. 'label' => __( 'Link Color', 'elementor' ),
  981. 'type' => Controls_Manager::COLOR,
  982. 'default' => '',
  983. 'selectors' => [
  984. '{{WRAPPER}} a' => 'color: {{VALUE}};',
  985. ],
  986. ]
  987. );
  988. $this->add_control(
  989. 'color_link_hover',
  990. [
  991. 'label' => __( 'Link Hover Color', 'elementor' ),
  992. 'type' => Controls_Manager::COLOR,
  993. 'default' => '',
  994. 'selectors' => [
  995. '{{WRAPPER}} a:hover' => 'color: {{VALUE}};',
  996. ],
  997. ]
  998. );
  999. $this->add_control(
  1000. 'text_align',
  1001. [
  1002. 'label' => __( 'Text Align', 'elementor' ),
  1003. 'type' => Controls_Manager::CHOOSE,
  1004. 'options' => [
  1005. 'left' => [
  1006. 'title' => __( 'Left', 'elementor' ),
  1007. 'icon' => 'fa fa-align-left',
  1008. ],
  1009. 'center' => [
  1010. 'title' => __( 'Center', 'elementor' ),
  1011. 'icon' => 'fa fa-align-center',
  1012. ],
  1013. 'right' => [
  1014. 'title' => __( 'Right', 'elementor' ),
  1015. 'icon' => 'fa fa-align-right',
  1016. ],
  1017. ],
  1018. 'selectors' => [
  1019. '{{WRAPPER}} > .elementor-container' => 'text-align: {{VALUE}};',
  1020. ],
  1021. ]
  1022. );
  1023. $this->end_controls_section();
  1024. // Section Advanced
  1025. $this->start_controls_section(
  1026. 'section_advanced',
  1027. [
  1028. 'label' => __( 'Advanced', 'elementor' ),
  1029. 'tab' => Controls_Manager::TAB_ADVANCED,
  1030. ]
  1031. );
  1032. $this->add_responsive_control(
  1033. 'margin',
  1034. [
  1035. 'label' => __( 'Margin', 'elementor' ),
  1036. 'type' => Controls_Manager::DIMENSIONS,
  1037. 'size_units' => [ 'px', '%' ],
  1038. 'allowed_dimensions' => 'vertical',
  1039. 'placeholder' => [
  1040. 'top' => '',
  1041. 'right' => 'auto',
  1042. 'bottom' => '',
  1043. 'left' => 'auto',
  1044. ],
  1045. 'selectors' => [
  1046. '{{WRAPPER}}' => 'margin-top: {{TOP}}{{UNIT}}; margin-bottom: {{BOTTOM}}{{UNIT}};',
  1047. ],
  1048. ]
  1049. );
  1050. $this->add_responsive_control(
  1051. 'padding',
  1052. [
  1053. 'label' => __( 'Padding', 'elementor' ),
  1054. 'type' => Controls_Manager::DIMENSIONS,
  1055. 'size_units' => [ 'px', 'em', '%' ],
  1056. 'selectors' => [
  1057. '{{WRAPPER}}' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
  1058. ],
  1059. ]
  1060. );
  1061. $this->add_control(
  1062. 'z_index',
  1063. [
  1064. 'label' => __( 'Z-Index', 'elementor' ),
  1065. 'type' => Controls_Manager::NUMBER,
  1066. 'min' => 0,
  1067. 'selectors' => [
  1068. '{{WRAPPER}}' => 'z-index: {{VALUE}};',
  1069. ],
  1070. 'label_block' => false,
  1071. ]
  1072. );
  1073. $this->add_control(
  1074. 'animation',
  1075. [
  1076. 'label' => __( 'Entrance Animation', 'elementor' ),
  1077. 'type' => Controls_Manager::ANIMATION,
  1078. 'default' => '',
  1079. 'prefix_class' => 'animated ',
  1080. 'label_block' => false,
  1081. 'frontend_available' => true,
  1082. ]
  1083. );
  1084. $this->add_control(
  1085. 'animation_duration',
  1086. [
  1087. 'label' => __( 'Animation Duration', 'elementor' ),
  1088. 'type' => Controls_Manager::SELECT,
  1089. 'default' => '',
  1090. 'options' => [
  1091. 'slow' => __( 'Slow', 'elementor' ),
  1092. '' => __( 'Normal', 'elementor' ),
  1093. 'fast' => __( 'Fast', 'elementor' ),
  1094. ],
  1095. 'prefix_class' => 'animated-',
  1096. 'condition' => [
  1097. 'animation!' => '',
  1098. ],
  1099. ]
  1100. );
  1101. $this->add_control(
  1102. 'animation_delay',
  1103. [
  1104. 'label' => __( 'Animation Delay', 'elementor' ) . ' (ms)',
  1105. 'type' => Controls_Manager::NUMBER,
  1106. 'default' => '',
  1107. 'min' => 0,
  1108. 'step' => 100,
  1109. 'condition' => [
  1110. 'animation!' => '',
  1111. ],
  1112. 'render_type' => 'none',
  1113. 'frontend_available' => true,
  1114. ]
  1115. );
  1116. $this->add_control(
  1117. '_element_id',
  1118. [
  1119. 'label' => __( 'CSS ID', 'elementor' ),
  1120. 'type' => Controls_Manager::TEXT,
  1121. 'default' => '',
  1122. 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ),
  1123. 'label_block' => false,
  1124. 'style_transfer' => false,
  1125. ]
  1126. );
  1127. $this->add_control(
  1128. 'css_classes',
  1129. [
  1130. 'label' => __( 'CSS Classes', 'elementor' ),
  1131. 'type' => Controls_Manager::TEXT,
  1132. 'default' => '',
  1133. 'prefix_class' => '',
  1134. 'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor' ),
  1135. 'label_block' => false,
  1136. ]
  1137. );
  1138. $this->end_controls_section();
  1139. // Section Responsive
  1140. $this->start_controls_section(
  1141. '_section_responsive',
  1142. [
  1143. 'label' => __( 'Responsive', 'elementor' ),
  1144. 'tab' => Controls_Manager::TAB_ADVANCED,
  1145. ]
  1146. );
  1147. $this->add_control(
  1148. 'reverse_order_tablet',
  1149. [
  1150. 'label' => __( 'Reverse Columns', 'elementor' ) . ' (' . __( 'Tablet', 'elementor' ) . ')',
  1151. 'type' => Controls_Manager::SWITCHER,
  1152. 'default' => '',
  1153. 'prefix_class' => 'elementor-',
  1154. 'return_value' => 'reverse-tablet',
  1155. ]
  1156. );
  1157. $this->add_control(
  1158. 'reverse_order_mobile',
  1159. [
  1160. 'label' => __( 'Reverse Columns', 'elementor' ) . ' (' . __( 'Mobile', 'elementor' ) . ')',
  1161. 'type' => Controls_Manager::SWITCHER,
  1162. 'default' => '',
  1163. 'prefix_class' => 'elementor-',
  1164. 'return_value' => 'reverse-mobile',
  1165. ]
  1166. );
  1167. $this->add_control(
  1168. 'heading_visibility',
  1169. [
  1170. 'label' => __( 'Visibility', 'elementor' ),
  1171. 'type' => Controls_Manager::HEADING,
  1172. 'separator' => 'before',
  1173. ]
  1174. );
  1175. $this->add_control(
  1176. 'responsive_description',
  1177. [
  1178. 'raw' => __( 'Attention: The display settings (show/hide for mobile, tablet or desktop) will only take effect once you are on the preview or live page, and not while you\'re in editing mode in Elementor.', 'elementor' ),
  1179. 'type' => Controls_Manager::RAW_HTML,
  1180. 'content_classes' => 'elementor-descriptor',
  1181. ]
  1182. );
  1183. $this->add_control(
  1184. 'hide_desktop',
  1185. [
  1186. 'label' => __( 'Hide On Desktop', 'elementor' ),
  1187. 'type' => Controls_Manager::SWITCHER,
  1188. 'default' => '',
  1189. 'prefix_class' => 'elementor-',
  1190. 'label_on' => __( 'Hide', 'elementor' ),
  1191. 'label_off' => __( 'Show', 'elementor' ),
  1192. 'return_value' => 'hidden-desktop',
  1193. ]
  1194. );
  1195. $this->add_control(
  1196. 'hide_tablet',
  1197. [
  1198. 'label' => __( 'Hide On Tablet', 'elementor' ),
  1199. 'type' => Controls_Manager::SWITCHER,
  1200. 'default' => '',
  1201. 'prefix_class' => 'elementor-',
  1202. 'label_on' => __( 'Hide', 'elementor' ),
  1203. 'label_off' => __( 'Show', 'elementor' ),
  1204. 'return_value' => 'hidden-tablet',
  1205. ]
  1206. );
  1207. $this->add_control(
  1208. 'hide_mobile',
  1209. [
  1210. 'label' => __( 'Hide On Mobile', 'elementor' ),
  1211. 'type' => Controls_Manager::SWITCHER,
  1212. 'default' => '',
  1213. 'prefix_class' => 'elementor-',
  1214. 'label_on' => __( 'Hide', 'elementor' ),
  1215. 'label_off' => __( 'Show', 'elementor' ),
  1216. 'return_value' => 'hidden-phone',
  1217. ]
  1218. );
  1219. $this->end_controls_section();
  1220. Plugin::$instance->controls_manager->add_custom_css_controls( $this );
  1221. }
  1222. /**
  1223. * Render section edit tools.
  1224. *
  1225. * Used to generate the edit tools HTML.
  1226. *
  1227. * @since 1.8.0
  1228. * @access protected
  1229. */
  1230. protected function render_edit_tools() {
  1231. ?>
  1232. <div class="elementor-element-overlay">
  1233. <ul class="elementor-editor-element-settings elementor-editor-section-settings">
  1234. <?php foreach ( self::get_edit_tools() as $edit_tool_name => $edit_tool ) : ?>
  1235. <?php if ( 'add' === $edit_tool_name ) : ?>
  1236. <# if ( ! isInner ) { #>
  1237. <?php endif; ?>
  1238. <li class="elementor-editor-element-setting elementor-editor-element-<?php echo esc_attr( $edit_tool_name ); ?>" title="<?php echo esc_attr( $edit_tool['title'] ); ?>">
  1239. <i class="eicon-<?php echo esc_attr( $edit_tool['icon'] ); ?>" aria-hidden="true"></i>
  1240. <span class="elementor-screen-only"><?php echo esc_html( $edit_tool['title'] ); ?></span>
  1241. </li>
  1242. <?php if ( 'add' === $edit_tool_name ) : ?>
  1243. <# } #>
  1244. <?php endif; ?>
  1245. <?php endforeach; ?>
  1246. </ul>
  1247. </div>
  1248. <?php
  1249. }
  1250. /**
  1251. * Render section output in the editor.
  1252. *
  1253. * Used to generate the live preview, using a Backbone JavaScript template.
  1254. *
  1255. * @since 1.0.0
  1256. * @access protected
  1257. */
  1258. protected function _content_template() {
  1259. ?>
  1260. <# if ( settings.background_video_link ) { #>
  1261. <div class="elementor-background-video-container elementor-hidden-phone">
  1262. <div class="elementor-background-video-embed"></div>
  1263. <video class="elementor-background-video-hosted" autoplay loop muted></video>
  1264. </div>
  1265. <# } #>
  1266. <div class="elementor-background-overlay"></div>
  1267. <div class="elementor-shape elementor-shape-top"></div>
  1268. <div class="elementor-shape elementor-shape-bottom"></div>
  1269. <div class="elementor-container elementor-column-gap-{{ settings.gap }}">
  1270. <div class="elementor-row"></div>
  1271. </div>
  1272. <?php
  1273. }
  1274. /**
  1275. * Before section rendering.
  1276. *
  1277. * Used to add stuff before the section element.
  1278. *
  1279. * @since 1.0.0
  1280. * @access public
  1281. */
  1282. public function before_render() {
  1283. $settings = $this->get_settings_for_display();
  1284. ?>
  1285. <<?php echo esc_html( $this->get_html_tag() ); ?> <?php $this->print_render_attribute_string( '_wrapper' ); ?>>
  1286. <?php
  1287. if ( 'video' === $settings['background_background'] ) :
  1288. if ( $settings['background_video_link'] ) :
  1289. $video_properties = Embed::get_video_properties( $settings['background_video_link'] );
  1290. ?>
  1291. <div class="elementor-background-video-container elementor-hidden-phone">
  1292. <?php if ( $video_properties ) : ?>
  1293. <div class="elementor-background-video-embed"></div>
  1294. <?php else : ?>
  1295. <video class="elementor-background-video-hosted elementor-html5-video" autoplay loop muted></video>
  1296. <?php endif; ?>
  1297. </div>
  1298. <?php
  1299. endif;
  1300. endif;
  1301. $has_background_overlay = in_array( $settings['background_overlay_background'], [ 'classic', 'gradient' ], true ) ||
  1302. in_array( $settings['background_overlay_hover_background'], [ 'classic', 'gradient' ], true );
  1303. if ( $has_background_overlay ) :
  1304. ?>
  1305. <div class="elementor-background-overlay"></div>
  1306. <?php
  1307. endif;
  1308. if ( $settings['shape_divider_top'] ) {
  1309. $this->print_shape_divider( 'top' );
  1310. }
  1311. if ( $settings['shape_divider_bottom'] ) {
  1312. $this->print_shape_divider( 'bottom' );
  1313. }
  1314. ?>
  1315. <div class="elementor-container elementor-column-gap-<?php echo esc_attr( $settings['gap'] ); ?>">
  1316. <div class="elementor-row">
  1317. <?php
  1318. }
  1319. /**
  1320. * After section rendering.
  1321. *
  1322. * Used to add stuff after the section element.
  1323. *
  1324. * @since 1.0.0
  1325. * @access public
  1326. */
  1327. public function after_render() {
  1328. ?>
  1329. </div>
  1330. </div>
  1331. </<?php echo esc_html( $this->get_html_tag() ); ?>>
  1332. <?php
  1333. }
  1334. /**
  1335. * Add section render attributes.
  1336. *
  1337. * Used to add attributes to the current section wrapper HTML tag.
  1338. *
  1339. * @since 1.3.0
  1340. * @access protected
  1341. */
  1342. protected function _add_render_attributes() {
  1343. parent::_add_render_attributes();
  1344. $section_type = $this->get_data( 'isInner' ) ? 'inner' : 'top';
  1345. $this->add_render_attribute(
  1346. '_wrapper', 'class', [
  1347. 'elementor-section',
  1348. 'elementor-' . $section_type . '-section',
  1349. ]
  1350. );
  1351. $this->add_render_attribute( '_wrapper', 'data-element_type', $this->get_name() );
  1352. }
  1353. /**
  1354. * Get default child type.
  1355. *
  1356. * Retrieve the section child type based on element data.
  1357. *
  1358. * @since 1.0.0
  1359. * @access protected
  1360. *
  1361. * @param array $element_data Element ID.
  1362. *
  1363. * @return Element_Base Section default child type.
  1364. */
  1365. protected function _get_default_child_type( array $element_data ) {
  1366. return Plugin::$instance->elements_manager->get_element_types( 'column' );
  1367. }
  1368. /**
  1369. * Get HTML tag.
  1370. *
  1371. * Retrieve the section element HTML tag.
  1372. *
  1373. * @since 1.5.3
  1374. * @access private
  1375. *
  1376. * @return string Section HTML tag.
  1377. */
  1378. private function get_html_tag() {
  1379. $html_tag = $this->get_settings( 'html_tag' );
  1380. if ( empty( $html_tag ) ) {
  1381. $html_tag = 'section';
  1382. }
  1383. return $html_tag;
  1384. }
  1385. /**
  1386. * Print section shape divider.
  1387. *
  1388. * Used to generate the shape dividers HTML.
  1389. *
  1390. * @since 1.3.0
  1391. * @access private
  1392. *
  1393. * @param string $side Shape divider side, used to set the shape key.
  1394. */
  1395. private function print_shape_divider( $side ) {
  1396. $settings = $this->get_active_settings();
  1397. $base_setting_key = "shape_divider_$side";
  1398. $negative = ! empty( $settings[ $base_setting_key . '_negative' ] );
  1399. ?>
  1400. <div class="elementor-shape elementor-shape-<?php echo esc_attr( $side ); ?>" data-negative="<?php echo var_export( $negative ); ?>">
  1401. <?php include Shapes::get_shape_path( $settings[ $base_setting_key ], ! empty( $settings[ $base_setting_key . '_negative' ] ) ); ?>
  1402. </div>
  1403. <?php
  1404. }
  1405. }