Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Hi there,
I have built a custom SiteOrigin widget which has one repeater inside. That repeater has State emitter field and a few State handler fields inside.
The problem arises when I duplicate repeater’s item. State handler fields are not working anymore in that second (duplicated) repeater’s item. When i save/update the page, everything works normal again.
Could anyone help me with this?
here is my repeater code:
'test_collapse_repeater' => array(
'type' => 'repeater',
'label' => __( 'Collapse' , 'test-widgets-bundle' ),
'item_name' => __( 'Collapse Item', 'test-widgets-bundle' ),
'item_label' => array(
'selector' => "[id*='test_collapse_title']",
'update_event' => 'change',
'value_method' => 'val'
),
'fields' => array(
'test_collapse_name' => array(
'type' => 'text',
'label' => __( 'Name', 'test-widgets-bundle' ),
'optional' => false,
),
'test_collapse_choose_media_type' => array(
'type' => 'radio',
'label' => __( 'Choose Media type?', 'test-widgets-bundle' ),
'default' => 'image',
'options' => array(
'image' => __( 'Image', 'test-widgets-bundle' ),
'icon' => __( 'Icon', 'test-widgets-bundle' ),
'initials' => __( 'Initials', 'test-widgets-bundle' ),
),
'state_emitter' => array(
'callback' => 'select',
'args' => array(
'test_collapse_choose_media_type_{$repeater}'
)
),
),
'test_collapse_image' => array(
'type' => 'media',
'label' => __( 'Image', 'test-widgets-bundle' ),
'choose' => __( 'Choose image', 'test-widgets-bundle' ),
'update' => __( 'Set image', 'test-widgets-bundle' ),
'library' => 'image',
'state_handler' => array(
'test_collapse_choose_media_type_{$repeater}[image]' => array('show'),
'test_collapse_choose_media_type_{$repeater}[icon]' => array('hide'),
'test_collapse_choose_media_type_{$repeater}[initials]' => array('hide'),
)
),
'test_collapse_icon' => array(
'type' => 'icon',
'label' => __( 'Choose Icon', 'test-widgets-bundle' ),
'state_handler' => array(
'test_collapse_choose_media_type_{$repeater}[image]' => array('hide'),
'test_collapse_choose_media_type_{$repeater}[icon]' => array('show'),
'test_collapse_choose_media_type_{$repeater}[initials]' => array('hide'),
)
),
'test_collapse_initials' => array(
'type' => 'text',
'label' => __( 'Initials', 'test-widgets-bundle' ),
'state_handler' => array(
'test_collapse_choose_media_type_{$repeater}[image]' => array('hide'),
'test_collapse_choose_media_type_{$repeater}[icon]' => array('hide'),
'test_collapse_choose_media_type_{$repeater}[initials]' => array('show'),
)
),
)
)
Thanks!