$this->attributes(), 'render_callback' => [$this, 'render'] ) ); } function attributes(){ return array( 'align' => array( 'type' => 'string', 'default' => '' ), 'cId' => array( 'type' => 'string', 'default' => '' ), 'slides' => array( 'type' => 'array', 'default' => array( array( 'background' => array( 'color' => '#00000080' ), 'position' => 'center center', 'title' => 'Slide Title 1', 'description' => 'This content area describes slider 1 descriptions/details.', 'btnText' => 'Button 1', 'btnLink' => '#' ), array( 'background' => array( 'color' => '#00000080' ), 'position' => 'center center', 'title' => 'Slide Title 2', 'description' => 'This content area describes slider 2 descriptions/details.', 'btnText' => 'Button 2', 'btnLink' => '#' ) ) ), 'columns' => array( 'type' => 'object', 'default' => array( 'desktop' => 1, 'tablet' => 1, 'mobile' => 1 ) ), 'columnGap' => array( 'type' => 'string', 'default' => 15 ), 'sliderWidth' => array( 'type' => 'string', 'default' => '100%' ), 'sliderHeight' => array( 'type' => 'string', 'default' => '400px' ), 'sliderAlign' => array( 'type' => 'string', 'default' => 'center' ), 'isLoop' => array( 'type' => 'boolean', 'default' => true ), 'isTouchMove' => array( 'type' => 'boolean', 'default' => false ), 'isAutoplay' => array( 'type' => 'boolean', 'default' => true ), 'speed' => array( 'type' => 'number', 'default' => 1.5 ), 'effect' => array( 'type' => 'string', 'default' => 'slide' ), 'isPage' => array( 'type' => 'boolean', 'default' => true ), 'isPageClickable' => array( 'type' => 'boolean', 'default' => true ), 'isPageDynamic' => array( 'type' => 'boolean', 'default' => true ), 'pageColor' => array( 'type' => 'string', 'default' => '#fff' ), 'pageWidth' => array( 'type' => 'string', 'default' => '15px' ), 'pageHeight' => array( 'type' => 'string', 'default' => '15px' ), 'pageBorder' => array( 'type' => 'object', 'default' => array( 'radius' => '50%' ) ), 'isPrevNext' => array( 'type' => 'boolean', 'default' => true ), 'prevNextColor' => array( 'type' => 'string', 'default' => '#fff' ), 'isTitle' => array( 'type' => 'boolean', 'default' => true ), 'titleTypo' => array( 'type' => 'object', 'default' => array( 'fontSize' => 25 ) ), 'titleColor' => array( 'type' => 'string', 'default' => '#fff' ), 'titleMargin' => array( 'type' => 'object', 'default' => array( 'bottom' => '15px' ) ), 'isDesc' => array( 'type' => 'boolean', 'default' => true ), 'descTypo' => array( 'type' => 'object', 'default' => array( 'fontSize' => 15 ) ), 'descColor' => array( 'type' => 'string', 'default' => '#fff' ), 'descMargin' => array( 'type' => 'object', 'default' => array( 'bottom' => '15px' ) ), 'isBtn' => array( 'type' => 'boolean', 'default' => true ), 'btnTypo' => array( 'type' => 'object', 'default' => array( 'fontSize' => 16 ) ), 'btnColors' => array( 'type' => 'object', 'default' => array( 'color' => '#fff', 'bg' => '#4527a4' ) ), 'btnHovColors' => array( 'type' => 'object', 'default' => array( 'color' => '#fff', 'bg' => '#8344c5' ) ), 'btnPadding' => array( 'type' => 'object', 'default' => array( 'vertical' => '12px', 'horizontal' => '35px' ) ), 'btnBorder' => array( 'type' => 'object', 'default' => array( 'radius' => '3px' ) ) ); } function render( $attributes ){ extract( $attributes ); // Generate Styles $sliderStyle = new BBlocksStyleGenerator(); $sliderStyle::addStyle( "#bBlocksSlider-$cId", array( 'text-align' => $sliderAlign ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider", array( 'width' => $sliderWidth, 'height' => $sliderHeight ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider .slide", array( 'height' => $sliderHeight ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider .slide .sliderTitle", array( 'color' => $titleColor, $titleTypo['styles'] ?? 'font-size: 25px;' => '', 'margin' => $titleMargin['styles'] ?? '0 0 15px 0' ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider .slide .sliderDescription", array( 'color' => $descColor, $descTypo['styles'] ?? 'font-size: 15px;' => '', 'margin' => $descMargin['styles'] ?? '0 0 15px 0' ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider .slide .sliderBtn", array( $btnColors['styles'] ?? 'color: #fff; background: #4527a4;' => '', $btnTypo['styles'] ?? 'font-size: 16px;' => '', 'padding' => $btnPadding['styles'] ?? '12px 35px', $btnBorder['styles'] ?? 'border-radius: 3px;' => '' ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider .slide .sliderBtn:hover", array( $btnHovColors['styles'] ?? 'color: #fff; background: #8344c5;' => '' ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider .swiper-pagination .swiper-pagination-bullet", array( 'background' => $pageColor, 'width' => $pageWidth, 'height' => $pageHeight, $pageBorder['styles'] ?? 'border-radius: 50%;' => '' ) ); $sliderStyle::addStyle( "#bBlocksSlider-$cId .bBlocksSlider .swiper-button-prev, #bBlocksSlider-$cId .bBlocksSlider .swiper-button-next", array( 'color' => $prevNextColor ) ); $jsonData = json_encode( array( 'columns' => $columns ?? array( 'desktop' => 1, 'tablet' => 1, 'mobile' => 1 ), 'columnGap' => $columnGap ?? 15, 'isLoop' => $isLoop ?? true, 'isTouchMove' => $isTouchMove ?? false, 'isAutoplay' => $isAutoplay ?? true, 'speed' => $speed ?? 1.5, 'effect' => $effect ?? 'slide', 'isPageClickable' => $isPageClickable ?? true, 'isPageDynamic' => $isPageDynamic ?? true ) ); ob_start(); ?>
" : ''; ?>