Unlock Premium Features!
Upgrade to Clipboard Pro for enhanced functionality and exclusive benefits.
Ready to level up your experience?
See Pricing Plans ',
]
);
$self->end_controls_section();
}
/**
* Register "Get Pro" Sections
*
* @param object $self
* @param array $labels
*/
public static function register_pro_sections( $self, $labels = [] ) {
foreach ( $labels as $label ) {
self::register_pro_section( $self, $label );
}
}
/**
* Register normal and hover styles.
*
* @param object $self
* @param string $label
* @param array $args
*/
public static function register_style_section( $self, $label = '', $selector = '', $args = [] ) {
$id = 'reusable-' . sanitize_title_with_dashes( $label );
$size = isset( $args['size'] ) ? $args['size'] : false;
$text_decoration = isset( $args['text_decoration'] ) ? $args['text_decoration'] : false;
$margin = isset( $args['margin'] ) ? $args['margin'] : true;
$padding = isset( $args['padding'] ) ? $args['padding'] : true;
$border = isset( $args['border'] ) ? $args['border'] : false; // Disabled.
$border_radius = isset( $args['border_radius'] ) ? $args['border_radius'] : true;
$background = isset( $args['background'] ) ? $args['background'] : false; // Disabled.
$text_color = isset( $args['text_color'] ) ? $args['text_color'] : false; // Disabled.
$typography = isset( $args['typography'] ) ? $args['typography'] : true;
$text_align = isset( $args['text_align'] ) ? $args['text_align'] : true;
$box_shadow = isset( $args['box_shadow'] ) ? $args['box_shadow'] : false; // Disabled.
$tabs = isset( $args['tabs'] ) ? $args['tabs'] : true;
$normal_background = isset( $args['normal_background'] ) ? $args['normal_background'] : true;
$normal_text_color = isset( $args['normal_text_color'] ) ? $args['normal_text_color'] : true;
$normal_typography = isset( $args['normal_typography'] ) ? $args['normal_typography'] : false; // Disabled.
$normal_border = isset( $args['normal_border'] ) ? $args['normal_border'] : true;
$normal_box_shadow = isset( $args['normal_box_shadow'] ) ? $args['normal_box_shadow'] : true;
// Section.
$self->start_controls_section(
$id . '_style_section',
[
'label' => $label,
'tab' => Controls_Manager::TAB_STYLE,
]
);
if ( $margin ) :
$self->add_responsive_control(
$id . '_margin',
[
'label' => esc_html__( 'Margin', 'copy-the-code' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} ' . $selector => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
endif;
if ( $padding ) :
$self->add_responsive_control(
$id . '_padding',
[
'label' => esc_html__( 'Padding', 'copy-the-code' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} ' . $selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
endif;
if ( $border ) :
$border_selector = '{{WRAPPER}} ' . $selector;
if ( isset( $args['border'] ) && is_array( $args['border'] ) ) {
if ( isset( $args['border']['selector'] ) ) {
$border_selector = $args['border']['selector'];
}
}
$self->add_group_control(
Group_Control_Border::get_type(),
[
'name' => $id . '_border',
'selector' => $border_selector,
]
);
endif;
if ( $border_radius ) :
$self->add_responsive_control(
$id . '_border_radius',
[
'label' => esc_html__( 'Border Radius', 'copy-the-code' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} ' . $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
endif;
if ( $background ) :
$self->add_group_control(
Group_Control_Background::get_type(),
[
'name' => $id . '_background',
'types' => [ 'classic', 'gradient', 'image', 'video' ],
'selector' => '{{WRAPPER}} ' . $selector,
]
);
endif;
if ( $text_color ) :
$self->add_control(
$id . '_text_color',
[
'label' => esc_html__( 'Text Color', 'copy-the-code' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} ' . $selector => 'color: {{VALUE}};',
],
]
);
endif;
if ( $typography ) :
$self->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => $id . '_typography',
'selector' => '{{WRAPPER}} ' . $selector,
]
);
endif;
if ( $size ) :
$size_label = esc_html__( 'Width', 'copy-the-code' );
$size_selectors = [
'{{WRAPPER}} ' . $selector => 'width: {{SIZE}}{{UNIT}};',
];
if ( isset( $args['size'] ) && is_array( $args['size'] ) ) {
if ( isset( $args['size']['selectors'] ) ) {
$size_selectors = $args['size']['selectors'];
}
if ( isset( $args['size']['label'] ) ) {
$size_label = $args['size']['label'];
}
}
$self->add_responsive_control(
$id . '_size',
[
'label' => $size_label,
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => $size_selectors,
]
);
endif;
if ( $text_decoration ) :
$text_decoration_selectors = [
'{{WRAPPER}} ' . $selector => 'text-decoration: {{VALUE}};',
];
if ( isset( $args['text_decoration'] ) && is_array( $args['text_decoration'] ) ) {
if ( isset( $args['text_decoration']['selectors'] ) ) {
$text_decoration_selectors = $args['text_decoration']['selectors'];
}
}
$self->add_control(
$id . '_text_decoration',
[
'label' => esc_html__( 'Text Decoration', 'copy-the-code' ),
'type' => Controls_Manager::SELECT,
'options' => [
'none' => esc_html__( 'None', 'copy-the-code' ),
'underline' => esc_html__( 'Underline', 'copy-the-code' ),
'overline' => esc_html__( 'Overline', 'copy-the-code' ),
'line-through' => esc_html__( 'Line Through', 'copy-the-code' ),
],
'selectors' => $text_decoration_selectors,
]
);
endif;
if ( $text_align ) :
$self->add_responsive_control(
$id . '_text_align',
[
'label' => esc_html__( 'Alignment', 'copy-the-code' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'copy-the-code' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'copy-the-code' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'copy-the-code' ),
'icon' => 'eicon-text-align-right',
],
],
'selectors' => [
'{{WRAPPER}} ' . $selector => 'text-align: {{VALUE}};',
],
]
);
endif;
if ( $box_shadow ) :
$self->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => $id . '_box_shadow',
'selector' => '{{WRAPPER}} ' . $selector,
]
);
endif;
if ( $tabs ) :
// Tabs.
$self->start_controls_tabs(
$id . '_style_tabs'
);
// Normal.
$self->start_controls_tab(
$id . '_style_normal_tab',
[
'label' => esc_html__( 'Normal', 'copy-the-code' ),
]
);
if ( $normal_background ) :
$self->add_group_control(
Group_Control_Background::get_type(),
[
'name' => $id . '_normal_background',
'types' => [ 'classic', 'gradient', 'image', 'video' ],
'selector' => '{{WRAPPER}} ' . $selector,
]
);
endif;
if ( $normal_text_color ) :
$normal_text_color_label = esc_html__( 'Text Color', 'copy-the-code' );
$normal_text_color_selectors = [
'{{WRAPPER}} ' . $selector => 'color: {{VALUE}};',
];
if ( isset( $args['normal_text_color'] ) && is_array( $args['normal_text_color'] ) ) {
if ( isset( $args['normal_text_color']['selectors'] ) ) {
$normal_text_color_selectors = $args['normal_text_color']['selectors'];
}
if ( isset( $args['normal_text_color']['label'] ) ) {
$normal_text_color_label = $args['normal_text_color']['label'];
}
}
$self->add_control(
$id . '_normal_text_color',
[
'label' => $normal_text_color_label,
'type' => Controls_Manager::COLOR,
'selectors' => $normal_text_color_selectors,
]
);
endif;
if ( $normal_typography ) :
$self->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => $id . '_normal_typography',
'selector' => '{{WRAPPER}} ' . $selector,
]
);
endif;
if ( $normal_border ) :
$self->add_group_control(
Group_Control_Border::get_type(),
[
'name' => $id . '_normal_border',
'default' => 'red',
'selector' => '{{WRAPPER}} ' . $selector,
]
);
endif;
if ( $normal_box_shadow ) :
$self->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => $id . '_normal_box_shadow',
'selector' => '{{WRAPPER}} ' . $selector,
]
);
endif;
$self->end_controls_tab();
// Normal End.
// Hover.
$self->start_controls_tab(
$id . '_style_hover_tab',
[
'label' => esc_html__( 'Hover', 'copy-the-code' ),
]
);
if ( $normal_background ) :
$self->add_group_control(
Group_Control_Background::get_type(),
[
'name' => $id . '_hover_background',
'types' => [ 'classic', 'gradient', 'image', 'video' ],
'selector' => '{{WRAPPER}} ' . $selector . ':hover',
]
);
endif;
if ( $normal_text_color ) :
$hover_text_color_label = esc_html__( 'Text Color', 'copy-the-code' );
$hover_text_color_selectors = [
'{{WRAPPER}} ' . $selector => 'color: {{VALUE}};',
];
if ( isset( $args['hover_text_color'] ) && is_array( $args['hover_text_color'] ) ) {
if ( isset( $args['hover_text_color']['selectors'] ) ) {
$hover_text_color_selectors = $args['hover_text_color']['selectors'];
}
if ( isset( $args['hover_text_color']['label'] ) ) {
$hover_text_color_label = $args['hover_text_color']['label'];
}
}
$self->add_control(
$id . '_hover_text_color',
[
'label' => $hover_text_color_label,
'type' => Controls_Manager::COLOR,
'selectors' => $hover_text_color_selectors,
]
);
endif;
if ( $normal_border ) :
$self->add_control(
$id . '_hover_border',
[
'label' => esc_html__( 'Border Color', 'copy-the-code' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} ' . $selector . ':hover' => 'border-color: {{VALUE}};',
],
]
);
endif;
if ( $normal_box_shadow ) :
$self->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => $id . '_hover_box_shadow',
'selector' => '{{WRAPPER}} ' . $selector . ':hover',
]
);
endif;
$self->end_controls_tab();
// Hover End.
$self->end_controls_tabs();
// Tabs.
endif;
$self->end_controls_section();
// Section End.
}
}