-
-
Save wplit/57f155899a451effd06d078a469b7545 to your computer and use it in GitHub Desktop.
element with nested repeater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class repeaterTestElement extends \Bricks\Element { | |
// Element properties | |
public $category = 'general'; | |
public $name = 'testelement'; | |
public $icon = 'ti-view-list-alt'; | |
public $css_selector = ''; | |
public function get_label() { | |
return esc_html__( 'Testing repeaters', 'extras' ); | |
} | |
public function set_controls() { | |
$this->controls['firstRepeater'] = [ | |
'tab' => 'content', | |
'label' => esc_html__( 'Add items', 'bricks' ), | |
'title' => esc_html__( 'Add item', 'bricks' ), | |
'type' => 'repeater', /* first repeater */ | |
'titleProperty' => 'label', | |
'fields' => [ | |
'title' => [ | |
'label' => esc_html__( 'Some title', 'bricks' ), | |
'type' => 'text', | |
], | |
'secondRepeater' => [ | |
'label' => esc_html__( 'Add child items', 'bricks' ), | |
'type' => 'repeater', /* nested repeater */ | |
'fields' => [ | |
'title' => [ | |
'label' => esc_html__( 'Some title', 'bricks' ), | |
'type' => 'text', | |
], | |
] | |
] | |
] | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment