PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.2.0
UiCore Elements – Free widgets and templates for Elementor v1.2.0
1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 41 releases
uicore-elements / includes / utils / grid-component.php

grid-component.php in UiCore Elements – Free widgets and templates for Elementor 1.2.0, at includes/utils/grid-component.php

83 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace UiCoreElements\Utils;
3
4 use Elementor\Controls_Manager;
5 use Elementor\Group_Control_Background;
6 use Elementor\Group_Control_Border;
7 use Elementor\Group_Control_Box_Shadow;
8
9 defined('ABSPATH') || exit();
10
11 trait Grid_Trait {
12
13 /**
14 * Registers the grid layout controls.
15 *
16 * @param array $conditions Conditions for the grid layout controls. Eg: ['{control-slug}' => '{control-value}']
17 */
18 function TRAIT_register_grid_layout_controls($conditions = [])
19 {
20
21 $this->add_responsive_control(
22 'columns',
23 [
24 'label' => __( 'Columns', 'uicore-elements' ),
25 'type' => Controls_Manager::SELECT,
26 'desktop_default' => 3,
27 'tablet_default' => 2,
28 'mobile_default' => 1,
29 'options' => [
30 1 => '1',
31 2 => '2',
32 3 => '3',
33 4 => '4',
34 5 => '5',
35 6 => '6',
36 7 => '7',
37 8 => '8',
38 ],
39 'selectors' => [
40 '{{WRAPPER}} .ui-e-grid' => 'grid-template-columns: repeat({{VALUE}}, minmax(0, 1fr)); --ui-e-column-count: {{VALUE}};', // the var is used by masonry
41 '{{WRAPPER}} .ui-e-adv-grid' => 'grid-template-columns: repeat({{VALUE}}, minmax(0, 1fr))', // Old APG Suport
42 ],
43 'condition' => $conditions
44 ]
45 );
46 $this->add_responsive_control(
47 'gap',
48 [
49 'label' => esc_html__( 'Items Gap', 'uicore-elements' ),
50 'type' => Controls_Manager::SLIDER,
51 'size_units' => ['px'],
52 'range' => [
53 'px' => [
54 'min' => 0,
55 'max' => 200,
56 ],
57 ],
58 'default' => [
59 'unit' => 'px',
60 'size' => 20,
61 ],
62 'selectors' => [
63 '{{WRAPPER}} .ui-e-grid' => 'grid-gap: {{SIZE}}{{UNIT}};',
64 '{{WRAPPER}} .ui-e-adv-grid' => 'grid-gap: {{SIZE}}{{UNIT}};', // Old APG Suport
65 ],
66 'condition' => $conditions
67 ]
68 );
69 $this->add_control(
70 'masonry',
71 [
72 'label' => __('Masonry', 'uicore-elements'),
73 'type' => Controls_Manager::SWITCHER,
74 'selectors' => [
75 '{{WRAPPER}} .ui-e-grid' => 'column-count: var(--ui-e-column-count); column-gap: {{gap.SIZE}}{{gap.UNIT}};',
76 '{{WRAPPER}} .ui-e-wrp' => 'margin-bottom: {{gap.SIZE}}{{gap.UNIT}};'
77 ],
78 'render_type' => 'template',
79 'condition' => $conditions
80 ]
81 );
82 }
83 }