PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.18
UiCore Elements – Free widgets and templates for Elementor v1.3.18
1.3.18 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 All 42 releases
← All changes | includes/utils/grid-component.php +85 -83 1.0.12 → 1.3.18 View file →
@@ -1,83 +1,85 @@
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 bool $maso Whether to enable masonry layout. (Default: true)
17 - * @param array $maso_conditions The conditions for masonry layout.
18 - * @param bool $legacy_maso Whether to use legacy masonry layout.
19 - * @param bool/array $column_prefix Set a prefix class to be returned with the column value
20 - * @param array $gap_conditions The conditions for columns.
21 - */
22 - function TRAIT_register_grid_layout_controls()
23 - {
24 - $this->add_responsive_control(
25 - 'columns',
26 - [
27 - 'label' => __( 'Columns', 'uicore-elements' ),
28 - 'type' => Controls_Manager::SELECT,
29 - 'desktop_default' => 3,
30 - 'tablet_default' => 2,
31 - 'mobile_default' => 1,
32 - 'options' => [
33 - 1 => '1',
34 - 2 => '2',
35 - 3 => '3',
36 - 4 => '4',
37 - 5 => '5',
38 - 6 => '6',
39 - 7 => '7',
40 - 8 => '8',
41 - ],
42 - 'selectors' => [
43 - '{{WRAPPER}} .ui-e-grid' => 'grid-template-columns: repeat({{VALUE}}, minmax(0, 1fr)); --ui-e-column-count: {{VALUE}};', // the var is used by masonry
44 - '{{WRAPPER}} .ui-e-adv-grid' => 'grid-template-columns: repeat({{VALUE}}, minmax(0, 1fr))', // Old APG Suport
45 - ],
46 - ]
47 - );
48 - $this->add_responsive_control(
49 - 'gap',
50 - [
51 - 'label' => esc_html__( 'Items Gap', 'uicore-elements' ),
52 - 'type' => Controls_Manager::SLIDER,
53 - 'size_units' => ['px'],
54 - 'range' => [
55 - 'px' => [
56 - 'min' => 0,
57 - 'max' => 200,
58 - ],
59 - ],
60 - 'default' => [
61 - 'unit' => 'px',
62 - 'size' => 20,
63 - ],
64 - 'selectors' => [
65 - '{{WRAPPER}} .ui-e-grid' => 'grid-gap: {{SIZE}}{{UNIT}};',
66 - '{{WRAPPER}} .ui-e-adv-grid' => 'grid-gap: {{SIZE}}{{UNIT}};', // Old APG Suport
67 - ],
68 - ]
69 - );
70 - $this->add_control(
71 - 'masonry',
72 - [
73 - 'label' => __('Masonry', 'uicore-elements'),
74 - 'type' => Controls_Manager::SWITCHER,
75 - 'prefix_class' => 'ui-e-maso-',
76 - 'selectors' => [
77 - '{{WRAPPER}} .ui-e-grid' => 'column-count: var(--ui-e-column-count); column-gap: {{gap.SIZE}}{{gap.UNIT}};',
78 - '{{WRAPPER}} .ui-e-wrp' => 'margin-bottom: {{gap.SIZE}}{{gap.UNIT}};'
79 - ],
80 - ]
81 - );
82 - }
83 -}
1 +<?php
2 +
3 +namespace UiCoreElements\Utils;
4 +
5 +use Elementor\Controls_Manager;
6 +use Elementor\Group_Control_Background;
7 +use Elementor\Group_Control_Border;
8 +use Elementor\Group_Control_Box_Shadow;
9 +
10 +defined('ABSPATH') || exit();
11 +
12 +trait Grid_Trait
13 +{
14 +
15 + /**
16 + * Registers the grid layout controls.
17 + *
18 + * @param array $conditions Conditions for the grid layout controls. Eg: ['{control-slug}' => '{control-value}']
19 + */
20 + function TRAIT_register_grid_layout_controls($conditions = [])
21 + {
22 +
23 + $this->add_responsive_control(
24 + 'columns',
25 + [
26 + 'label' => __('Columns', 'uicore-elements'),
27 + 'type' => Controls_Manager::SELECT,
28 + 'desktop_default' => 3,
29 + 'tablet_default' => 2,
30 + 'mobile_default' => 1,
31 + 'options' => [
32 + 1 => '1',
33 + 2 => '2',
34 + 3 => '3',
35 + 4 => '4',
36 + 5 => '5',
37 + 6 => '6',
38 + 7 => '7',
39 + 8 => '8',
40 + ],
41 + 'selectors' => [
42 + '{{WRAPPER}} .ui-e-grid' => 'grid-template-columns: repeat({{VALUE}}, minmax(0, 1fr)); --ui-e-column-count: {{VALUE}};', // the var is used by masonry
43 + '{{WRAPPER}} .ui-e-adv-grid' => 'grid-template-columns: repeat({{VALUE}}, minmax(0, 1fr))', // Old APG Suport
44 + ],
45 + 'condition' => $conditions
46 + ]
47 + );
48 + $this->add_responsive_control(
49 + 'gap',
50 + [
51 + 'label' => esc_html__('Items Gap', 'uicore-elements'),
52 + 'type' => Controls_Manager::SLIDER,
53 + 'size_units' => ['px'],
54 + 'range' => [
55 + 'px' => [
56 + 'min' => 0,
57 + 'max' => 200,
58 + ],
59 + ],
60 + 'default' => [
61 + 'unit' => 'px',
62 + 'size' => 20,
63 + ],
64 + 'selectors' => [
65 + '{{WRAPPER}} .ui-e-grid' => 'grid-gap: {{SIZE}}{{UNIT}};',
66 + '{{WRAPPER}} .ui-e-adv-grid' => 'grid-gap: {{SIZE}}{{UNIT}};', // Old APG Suport
67 + ],
68 + 'condition' => $conditions
69 + ]
70 + );
71 + $this->add_control(
72 + 'masonry',
73 + [
74 + 'label' => __('Masonry', 'uicore-elements'),
75 + 'type' => Controls_Manager::SWITCHER,
76 + 'selectors' => [
77 + '{{WRAPPER}} .ui-e-grid' => 'column-count: var(--ui-e-column-count); column-gap: {{gap.SIZE}}{{gap.UNIT}};',
78 + '{{WRAPPER}} .ui-e-wrp' => 'margin-bottom: {{gap.SIZE}}{{gap.UNIT}};'
79 + ],
80 + 'render_type' => 'template',
81 + 'condition' => $conditions
82 + ]
83 + );
84 + }
85 +}