$this->attributes(), 'render_callback' => [$this, 'render'] ) ); } function attributes(){ return array( 'align' => array( 'type' => 'string', 'default' => '' ), 'cId' => array( 'type' => 'string', 'default' => '' ), 'cards' => array( 'type' => 'array', 'default' => array( array( 'background' => array( 'color' => '#0000' ), 'img' => array( 'id' => NULL, 'url' => '', 'alt' => '', 'title' => '' ), 'imgBorder' => array( 'radius' => '5px' ), 'cat' => 'Category 1', 'catColor' => '#0dcaf0', 'title' => 'Card Title 1', 'titleColor' => '#ff7500', 'desc' => 'This content area describes card 1 descriptions or details.', 'descColor' => '#333' ), array( 'background' => array( 'color' => '#0000' ), 'img' => array( 'id' => NULL, 'url' => '', 'alt' => '', 'title' => '' ), 'imgBorder' => array( 'radius' => '5px' ), 'cat' => 'Category 2', 'catColor' => '#0dcaf0', 'title' => 'Card Title 2', 'titleColor' => '#ff7500', 'desc' => 'This content area describes card 2 descriptions or details.', 'descColor' => '#333' ), array( 'background' => array( 'color' => '#0000' ), 'img' => array( 'id' => NULL, 'url' => '', 'alt' => '', 'title' => '' ), 'imgBorder' => array( 'radius' => '5px' ), 'cat' => 'Category 3', 'catColor' => '#0dcaf0', 'title' => 'Card Title 3', 'titleColor' => '#ff7500', 'desc' => 'This content area describes card 3 descriptions or details.', 'descColor' => '#333' ) ) ), 'columns' => array( 'type' => 'object', 'default' => array( 'desktop' => 3, 'tablet' => 2, 'mobile' => 1 ) ), 'columnGap' => array( 'type' => 'string', 'default' => '20px' ), 'rowGap' => array( 'type' => 'string', 'default' => '30px' ), 'layout' => array( 'type' => 'string', 'default' => 'vertical' ), 'textAlign' => array( 'type' => 'string', 'default' => 'left' ), 'padding' => array( 'type' => 'object', 'default' => array( 'vertical' => '20px', 'horizontal' => '10px' ) ), 'imgPos' => array( 'type' => 'string', 'default' => 'top' ), 'imgHeight' => array( 'type' => 'string', 'default' => '250px' ), 'isCat' => array( 'type' => 'boolean', 'default' => true ), 'catTypo' => array( 'type' => 'object', 'default' => array( 'fontSize' => 15 ) ), 'catMargin' => array( 'type' => 'object', 'default' => array( 'bottom' => '10px' ) ), 'isTitle' => array( 'type' => 'boolean', 'default' => true ), 'titlePos' => array( 'type' => 'string', 'default' => 'image' ), 'titleTypo' => array( 'type' => 'object', 'default' => array( 'fontSize' => 22 ) ), 'titleMargin' => array( 'type' => 'object', 'default' => array( 'bottom' => '10px' ) ), 'isDesc' => array( 'type' => 'boolean', 'default' => true ), 'descTypo' => array( 'type' => 'object', 'default' => array( 'fontSize' => 15 ) ) ); } function render( $attributes ){ extract( $attributes ); // Generate Styles $cardsStyle = new BBlocksStyleGenerator(); $cardsStyle::addStyle( "#bBlocksCards-$cId .bBlocksCards", array( 'grid-gap' => "$rowGap $columnGap" ) ); $cardsStyle::addStyle( "#bBlocksCards-$cId .bBlocksCards .bBlocksCard .cardImage img", array( 'height' => $imgHeight ) ); $cardsStyle::addStyle( "#bBlocksCards-$cId .bBlocksCards .bBlocksCard .cardDetails", array( 'text-align' => $textAlign, 'padding' => $padding['styles'] ?? '20px 10px' ) ); $cardsStyle::addStyle( "#bBlocksCards-$cId .bBlocksCards .bBlocksCard .cardDetails .cardCategory", array( $catTypo['styles'] ?? 'font-size: 15px;' => '', 'margin' => $catMargin['styles'] ?? '0 0 10px 0' ) ); $cardsStyle::addStyle( "#bBlocksCards-$cId .bBlocksCards .bBlocksCard .cardTitle", array( $titleTypo['styles'] ?? 'font-size: 22px;' => '', 'margin' => $titleMargin['styles'] ?? '0 0 10px 0' ) ); $cardsStyle::addStyle( "#bBlocksCards-$cId .bBlocksCards .bBlocksCard .cardDescription", array( $catTypo['styles'] ?? 'font-size: 15px;' => '' ) ); ob_start(); ?>