The example Element “Test element” in Create Your Own Elements has some mistakes
#1 Control Group “Text” is missing.
Original:
Fix: add $this->control_groups['settings']
$this->control_groups['settings'] = [
'title' => esc_html__( 'Settings', 'bricks' ),
'tab' => 'content',
];
// FIX
$this->control_groups['text'] = [
'title' => esc_html__( 'Text', 'bricks' ),
'tab' => 'content',
];
// FIX END
}
// Set builder controls
#2 Options of “Type” Control in “Setttings” Group isn’t set properly - so in the editor there is no drop down menu
Original:
Fix: Remove square bracket [ ]
in array of 'options'
$this->controls['type'] = [
'tab' => 'content',
'group' => 'settings',
'label' => esc_html__( 'Type', 'bricks' ),
'type' => 'select',
'options' => [
'info' => esc_html__( 'Info', 'bricks' ), // <- FIX: no [ ]
'success' => esc_html__( 'Success', 'bricks' ), // <- FIX: no [ ]
'warning' => esc_html__( 'Warning', 'bricks' ), // <- FIX: no [ ]
'danger' => esc_html__( 'Danger', 'bricks' ), // <- FIX: no [ ]
'muted' => esc_html__( 'Muted', 'bricks' ), // <- FIX: no [ ]
],
'inline' => true,
'clearable' => false,
'pasteStyles' => false,
'default' => 'info',
];
#3 using the color-
info/success/warning … class doesn’t make any sence because the classes arn’t declared, so changing the “Type” has no effect