PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.1.1
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.1.1
2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 106 releases
b-blocks / build / section-heading / render.php

render.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.1.1, at build/section-heading/render.php

56 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $prefix = 'bBlocksSectionHeading';
3 $id = wp_unique_id( "$prefix-" );
4 $planClass = BBlocks\Inc\Utils::isPro() ? 'pro' : 'free';
5
6 use BBlocks\Inc\GetCSS as GetCSS;
7
8 // Generate Styles
9 if( !function_exists( 'bBlocksSectionHeadingStyle' ) ) {
10 function bBlocksSectionHeadingStyle($attributes, $id, $prefix){
11 extract( $attributes );
12
13 $headingSl = "#$id .$prefix";
14
15 $sectionHeadingStyle = new BBlocksStyleGenerator();
16 $sectionHeadingStyle::addStyle( "$headingSl", [
17 'text-align' => $textAlign
18 ] );
19 $sectionHeadingStyle::addStyle( "$headingSl .sectionHeadingTitle", [
20 'color' => $titleColor,
21 'margin' => GetCSS::getSpaceCSS( $titleMargin )
22 ] );
23 $sectionHeadingStyle::addStyle( "$headingSl .sectionHeadingSeparator", [
24 GetCSS::getSeparatorCSS( $separator ) => '',
25 'margin' => GetCSS::getSpaceCSS( $sepMargin )
26 ] );
27 $sectionHeadingStyle::addStyle( "$headingSl .sectionHeadingDescription", [
28 'color' => $descColor,
29 'margin' => GetCSS::getSpaceCSS( $descMargin )
30 ] );
31
32 return GetCSS::getTypoCSS( '', $titleTypo )['googleFontLink'] .
33 GetCSS::getTypoCSS( '', $descTypo )['googleFontLink'] .
34 GetCSS::getTypoCSS( "$headingSl .sectionHeadingTitle", $titleTypo )['styles'] .
35 GetCSS::getTypoCSS( "$headingSl .sectionHeadingDescription", $descTypo )['styles'] .
36 $sectionHeadingStyle::renderStyle();
37 }
38 }
39
40 extract( $attributes );
41 ?>
42 <div
43 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- get_block_wrapper_attributes() is properly escaped ?>
44 <?php echo get_block_wrapper_attributes( [ 'class' => $planClass ] ); ?>
45 id='<?php echo esc_attr( $id ); ?>'
46 >
47 <style>
48 <?php echo esc_html( bBlocksSectionHeadingStyle( $attributes, $id, $prefix ) ); ?>
49 </style>
50
51 <div class='bBlocksSectionHeading'>
52 <h2 class='sectionHeadingTitle'><?php echo wp_kses_post( $title ); ?></h2>
53 <?php echo $isSep ? "<span class='sectionHeadingSeparator'></span>" : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static markup, no user input. ?>
54 <?php echo $isDesc ? "<p class='sectionHeadingDescription'>". wp_kses_post( $desc ) ."</p>" : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static wrapper tags with wp_kses_post-escaped content. ?>
55 </div>
56 </div>