Skip to content

Instantly share code, notes, and snippets.

@wplit
Last active May 11, 2023 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wplit/57f155899a451effd06d078a469b7545 to your computer and use it in GitHub Desktop.
Save wplit/57f155899a451effd06d078a469b7545 to your computer and use it in GitHub Desktop.
element with nested repeater
<?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