elementor/elementor

BUG: repeater label display issues

ramiy opened this issue · 0 comments

ramiy commented

Description

When hiding the main label in a "REPEATER" control, it also hides the labels of the "SLIDER" control. I should mention that other control labels are not affected, only the slider is affected by the main repeater.

bug

Steps to reproduce

Add 'show_label' => false to the main REPEATER control:

$this->add_control(
	'content',
	[
		'label' => __( 'Content', 'press-elements' ),
		'type' => Controls_Manager::REPEATER,
		'show_label' => false,
		'fields' => array_values( $repeater->get_controls() ),
		'title_field' => '{{{ heading }}}',
		'default' => [
			[
				'heading' => __( 'Text 1', 'press-elements' ),
				'vertical_position' => [
					'size' => 20,
					'unit' => '%',
				],
				'horizontal_position' => [
					'size' => 40,
					'unit' => '%',
				],
			],
			[
				'heading' => __( 'Text 2', 'press-elements' ),
				'vertical_position' => [
					'size' => 80,
					'unit' => '%',
				],
				'horizontal_position' => [
					'size' => 60,
					'unit' => '%',
				],
			]
		]
	]
);

All the repeater sub elements that use Controls_Manager::SLIDER have hidden labels.

I tried to add 'show_label' => true, to repeater fields. It didn't helped.

$repeater = new Repeater();

$repeater->start_controls_tabs( 'content_repeater' );

$repeater->start_controls_tab( 'pointer', [ 'label' => __( 'Pointer', 'press-elements' ) ] );

$repeater->add_responsive_control(
	'horizontal_position',
	[
		'label' => __( 'Horizontal Position (%)', 'press-elements' ),
		'type' => Controls_Manager::SLIDER,
		'show_label' => true,
		'size_units' => [ '%' ],
		'range' => [
			'%' => [
				'min' => 1,
				'max' => 100,
			],
		],
		'default' => [
			'size' => 50,
			'unit' => '%',
		],
		'selectors' => [
			'{{WRAPPER}} {{CURRENT_ITEM}} .item' => 'left: {{SIZE}}{{UNIT}};',
		],
	]
);

$repeater->add_responsive_control(
	'vertical_position',
	[
		'label' => __( 'Vertical Position (%)', 'press-elements' ),
		'type' => Controls_Manager::SLIDER,
		'size_units' => [ '%' ],
		'range' => [
			'%' => [
				'min' => 1,
				'max' => 100,
			],
		],
		'default' => [
			'size' => 50,
			'unit' => '%',
		],
		'selectors' => [
			'{{WRAPPER}} {{CURRENT_ITEM}} .item' => 'top: {{SIZE}}{{UNIT}};',
		],
	]
);

$repeater->end_controls_tab();

$repeater->end_controls_tabs();

Environment

  • WP 4.7.4
  • Elementor 1.4.6