'Header ' . $this->title,
'configuration_type' => 'sidebar',
'id' => 'header_' . $this->element_id,
'description' => esc_html__( 'Add widgets here:', 'brandy' ),
'before_widget' => '',
'before_title' => '
',
)
);
}
public function register_footer_sidebars() {
register_sidebar(
array(
'name' => 'Footer ' . $this->title,
'configuration_type' => 'sidebar',
'id' => 'footer_' . $this->element_id,
'description' => esc_html__( 'Add widgets here:', 'brandy' ),
'before_widget' => '',
'before_title' => '',
)
);
}
public function template_path() {
return 'template-parts/builder/elements/widget';
}
protected function register_components() {
return array(
'content' => array(
'type' => defined( 'BRANDY_BLOCKS_VERSION' ) ? 'Widget' : 'FlexibleContent',
'title' => array(
'text' => __( 'Widget content', 'brandy' ),
'type' => 'bold',
),
'content' => __( 'Please install Brandy Block to edit widget', 'brandy' ),
'default_value' => '',
'value_path' => array( 'content' ),
),
'horizontal_alignment' => array(
'title' => array(
'text' => __( 'Horizontal alignment', 'brandy' ),
'type' => 'bold',
'show_devices' => true,
),
'type' => 'HorizontalAlignment',
'default_value' => array(
'desktop' => 'left',
'tablet' => null,
'mobile' => null,
),
'value_path' => array( 'horizontal_alignment' ),
'render_options' => array(
'type' => 'variable',
'data' => array(
array(
'name' => '--brandy-text-align',
'value_path' => array( 'horizontal_alignment' ),
),
),
),
),
'vertical_alignment' => array(
'title' => array(
'text' => __( 'Vertical alignment', 'brandy' ),
'type' => 'bold',
'show_devices' => true,
),
'type' => 'VerticalAlignment',
'default_value' => array(
'desktop' => 'top',
'tablet' => null,
'mobile' => null,
),
'value_path' => array( 'vertical_alignment' ),
'render_options' => array(
'type' => 'variable',
'data' => array(
array(
'name' => '--brandy-vertical-align',
'value_path' => array( 'vertical_alignment' ),
),
),
),
),
'font_color' => array(
'title' => array(
'text' => __( 'Font color', 'brandy' ),
'type' => 'bold',
'show_devices' => true,
),
'type' => 'ColorGroup',
'default_value' => array(
'normal' => array(
'desktop' => 'var(--wp--preset--color--brandy-primary-text)',
'tablet' => null,
'mobile' => null,
),
'hover' => array(
'desktop' => 'var(--wp--preset--color--brandy-primary-text)',
'tablet' => null,
'mobile' => null,
),
),
'value_path' => array( 'font_color' ),
'render_options' => array(
'type' => 'variable',
'data' => array(
array(
'type' => 'color',
'name' => '--brandy-text-color',
'value_path' => array( 'font_color' ),
),
),
),
),
'links_decoration' => array(
'title' => array(
'text' => __( 'Links decoration', 'brandy' ),
'type' => 'bold',
),
'type' => 'ButtonGroup',
'default_value' => 'inherit',
'options' => array(
array(
'value' => 'normal',
'label' => __( 'Normal', 'brandy' ),
),
array(
'value' => 'inherit',
'label' => __( 'Inherit', 'brandy' ),
),
array(
'value' => 'underline',
'label' => __( 'Underline', 'brandy' ),
),
),
'value_path' => array( 'links_decoration' ),
'render_options' => array(
'type' => 'data_attribute',
'data' => array(
array(
'selector' => '.brandy-widget-content',
'name' => 'links-decoration',
'value_path' => array( 'links_decoration' ),
),
),
),
),
'margin' => array(
'title' => array(
'text' => __( 'Margin', 'brandy' ),
'type' => 'bold',
),
'value_path' => array( 'margin' ),
'type' => 'Spacing',
'default_value' => array(
'desktop' => array(
'unit' => 'px',
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0,
'is_constraints' => false,
),
'tablet' => null,
'mobile' => null,
),
'render_options' => array(
'type' => 'variable',
'data' => array(
array(
'type' => 'spacing',
'name' => '--brandy-margin',
'value_path' => array( 'margin' ),
),
),
),
),
);
}
public function register_element( $elements = array() ) {
$elements[ $this->element_id ] = array(
'id' => $this->element_id,
'title' => $this->title,
'settings' => $this->get_settings(),
'builders' => $this->builders,
'icon' => '
',
);
return $elements;
}
public function add_layout( $layouts = array() ) {
$layout = array(
'general' => array(
'sections' => array(
array(
'components' => array( 'content' ),
),
array(
'components' => array( 'horizontal_alignment' ),
),
array(
'components' => array( 'vertical_alignment' ),
),
),
),
'designs' => array(
'sections' => array(
array(
'components' => array( 'font_color' ),
),
array(
'components' => array( 'links_decoration' ),
),
array(
'components' => array( 'margin' ),
),
),
),
);
$mapped_layout = $this->map_layout( $layout );
$layouts[ $this->element_id ] = $mapped_layout;
return $layouts;
}
}