Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The fields_options parameter in the Elementor Background Group Control allows for customized options for background fields such as image, color, gradient, and video.

To utilize this parameter, follow these steps: 1. Open the Elementor editor and select the section or widget where you want to add a background. 2. In the Style tab, under the Background section, click on the Background Type dropdown and select Group. 3. Click on the Fields Options field to access the options. 4. The fields_options parameter accepts an array of options in key-value pairs. For example:

'fields_options' => [
  'image' => [
    'default' => [
      'url' => '',
      'id' => '',
    ],
    'upload_button' => true,
    'dynamic' => [
      'active' => true,
      'default' => Elementor\Repeater::create([
        [
          'name' => 'url',
          'type' => \Elementor\Controls_Manager::MEDIA,
          'label' => __( 'Background Image', 'textdomain' ),
          'dynamic' => [
            'active' => true,
          ],
        ],
      ]),
    ],
  ],
  'color' => [
    'default' => '',
    'inline_control' => true,
  ],
  'gradient' => [
    'default' => '',
    'type' => \Elementor\Controls_Manager::GRADIENT,
    'toggle' => true,
    'hue' => [
      'saturation' => 80,
      'lightness' => 60,
    ],
  ],
  'video' => [
    'default' => '',
    'type' => \Elementor\Group_Control_Video::get_type(),
  ],
],

In the above example, there are options for the image, color, gradient, and video fields. For the image field, there are options for the default value, upload button, and dynamic options. For the color field, there is an option for an inline control. For the gradient field, there are options for default value, type, toggle, and hue. For the video field, there is an option for the default value and type.

  1. Customize the options according to your needs.
  2. Save the changes and preview the result.