Skip to content

Commit decd163

Browse files
Group Control - advanced example using fields_options (#303)
1 parent 31bb5d4 commit decd163

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

src/editor-controls/group-control.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base {
9191
}
9292
```
9393

94-
### Group Control Label Modify
94+
### Group Control Fields Options
9595

96-
Here's an advanced setup for changing the background control label.
96+
Here's an advanced setup for changing inner controls inside the group control using `fields_options`:
9797

98-
```php {13-25}
98+
```php {13-40}
9999
class Elementor_Test_Widget extends \Elementor\Widget_Base {
100100

101101
protected function register_controls() {
@@ -109,17 +109,32 @@ class Elementor_Test_Widget extends \Elementor\Widget_Base {
109109
);
110110

111111
$this->add_group_control(
112-
Group_Control_Background::get_type(),
113-
[
114-
'name' => 'control_name',
115-
'label' => esc_html__( 'Background', 'textdomain' ),
116-
'types' => [ 'classic', 'gradient', 'video' ],
117-
'fields_options' => [
118-
'background' => [
119-
'label' => esc_html__( 'New Label Here...', 'textdomain' ),
120-
],
121-
],
122-
]
112+
\Elementor\Group_Control_Border::get_type(),
113+
[
114+
'name' => 'some_border',
115+
'label' => __( 'Box Border', 'textdomain' ),
116+
'fields_options' => [
117+
'border' => [
118+
'label' => __( 'Box Border Type', 'textdomain' ),
119+
'default' => 'solid',
120+
],
121+
'width' => [
122+
'label' => __( 'Box Border Width', 'textdomain' ),
123+
'default' => [
124+
'top' => '1',
125+
'right' => '2',
126+
'bottom' => '3',
127+
'left' => '4',
128+
'isLinked' => false,
129+
],
130+
],
131+
'color' => [
132+
'label' => __( 'Box Border Color', 'textdomain' ),
133+
'default' => '#D4D4D4',
134+
],
135+
],
136+
'selector' => '{{WRAPPER}} .some-box',
137+
]
123138
);
124139

125140
$this->end_controls_section();

0 commit comments

Comments
 (0)