Home>Support>State emitters and repeater

State emitters and repeater

Hi,
I have another question about repeater construcion and state emitters

'content' => array(
	'type' => 'repeater',
	'label' => __('Fields of content block', 'oskyr_widget'),
	'item_name' => __('Content', 'oskyr_widget'),
	 'item_label' => array(
		'selector'     => "[id*='type']",
		'update_event' => 'change',
		'value_method' => 'val'
	),
	'fields' => array(
		'type' => array(
			'type' => 'select',
			'label' => 'Type of content',
			'state_emitter' => array(
				'callback' => 'select',
				'args' => array( 'type' )
			),
			'options' => array(
				'headline' => __( 'Headline', 'oskyr_widget' ),
				'text'      => __( 'Text', 'oskyr_widget' ),
				'image'      => __( 'Image', 'oskyr_widget' ),
				'video'      => __( 'Video', 'oskyr_widget' ),
				'button'      => __( 'Button', 'oskyr_widget' ),
				'recipt'      => __( 'Recipt', 'oskyr_widget' ),
				'icon'      => __( 'Icon', 'oskyr_widget' ),
				'list_graph'      => __( 'Graph list', 'oskyr_widget' ),
				'list_guide'      => __( 'Guide list', 'oskyr_widget' ),
				'icon_group'      => __( 'Icon group', 'oskyr_widget' ),
			)
		),
		'headline' => array(
			'type'  => 'text',
			'label' => __( 'Headline text', 'oskyr_widget' ),
			'state_handler' => array(
				'type[headline]' => array( 'show' ),
				'_else[type]' => array( 'hide' ),
			),
		),
		'image' => array(
			'type'  => 'media',
			'label' => __( 'Choose image', 'oskyr_widget' ),
			'choose' => __( 'Choose image', 'oskyr_widget' ),
			'update' => __( 'Set image', 'oskyr_widget' ),
			'library' => 'image',
			'state_handler' => array(
				'type[image]' => array( 'show' ),
				'_else[type]' => array( 'hide' ),
			),
		),
	),

becuase when I change type of one content instance state handler changes all instances of content field. Can I split it somehow?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 14 days ago Braam Genis
    Hi, I Work Here

    Hi Łukasz Ziaja

    Another bug! :)

    Thanks again for letting us know about this. I’ve logged this as a potential bug in our issue tracker. We’ll investigate this as soon as possible and try come up with a fix.

    Cheers
    Braam

  2. 7 years, 11 months ago micemade

    Hi,
    I have the same issue. Any update on that ?
    Thanks

  3. 7 years, 11 months ago Greg Priday
    Hi, I Work Here

    Hi micemade

    This was fixed quite some time ago.

    https://siteorigin.com/docs/widgets-bundle/form-building/state-emitters/#heading-states-in-repeaters

    Hope that helps.

  4. 7 years, 11 months ago micemade

    oh, sorry, didn’t realize that … ( I checked that page, how did I miss that …?)
    Thanks Greg :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More