PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / trunk
Gutenify – Visual Site Builder Blocks & Starter Templates vtrunk
1.9.0 1.8.0 1.7.0 1.6.6 1.6.5 1.6.4 trunk 0.0.1 0.0.2 0.0.3 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 74 releases
gutenify / core / dist / blocks / testimonials / index.php

index.php in Gutenify – Visual Site Builder Blocks & Starter Templates trunk, at core/dist/blocks/testimonials/index.php

106 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace gutenify;
3
4 defined('ABSPATH') || exit;
5
6 class Testimonials
7 {
8 public static function init()
9 {
10 add_action('init', array(__CLASS__, 'register_block'));
11 add_filter('gutenify_render_block_gutenify/testimonials', array(__CLASS__, 'render_block'), 10, 4);
12 }
13
14 public static function register_block()
15 {
16 register_block_type(__DIR__);
17 }
18
19 public static function render_block($block_content, $block, $instance, $block_id)
20 {
21 $root_selector = '.' . $block_id;
22 $css = '';
23 $css = $root_selector . '{';
24
25
26 //color
27 if (!empty($block['attrs']['blockAdvanceOptions']['textColor'])) {
28 $css .= 'color: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['textColor'] ) . ';';
29 }
30
31 //background
32 if (!empty($block['attrs']['backgroundGradient'])) {
33 $css .= 'background: ' . esc_attr( $block['attrs']['backgroundGradient'] ) . ';';
34 }elseif (!empty($block['attrs']['backgroundColor'])) {
35 $css .= 'background:' . esc_attr( $block['attrs']['backgroundColor'] ) . ';';
36 } elseif (!empty($block['attrs']['blockAdvanceOptions']['backgroundGradient'])) {
37 $css .= 'background:' . esc_attr( $block['attrs']['blockAdvanceOptions']['backgroundGradient'] ) . ';';
38 }elseif (!empty($block['attrs']['blockAdvanceOptions']['backgroundColor'])) {
39 $css .= 'background:' . esc_attr( $block['attrs']['blockAdvanceOptions']['backgroundColor'] ) . ';';
40 }
41
42 //border color
43 if (!empty($block['attrs']['blockAdvanceOptions']['borderColor'])) {
44 $css .= 'border-color: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['borderColor'] ) . ';';
45 }
46
47
48
49 //border width
50 if ( ! empty( $block['attrs']['blockAdvanceOptions']['borderWidth'] ) ) {
51 $css .= 'border-style:solid;';
52 $css .= \gutenify\Style_Helpers::box_control( $block['attrs']['blockAdvanceOptions']['borderWidth'], 'border-', '-width');
53 }
54
55 if ( ! empty( $block['attrs']['blockAdvanceOptions']['borderRadius'] ) ) {
56 $css .= \gutenify\Style_Helpers::border_radius_control( $block['attrs']['blockAdvanceOptions']['borderRadius'] );
57 }
58 $css .= '}';
59 if(!empty($block['attrs']['blockAdvanceOptions']['textColor'])){
60 $css .= $root_selector . ' :where(h1,h2,h3,h4,h5,h6){
61 color: inherit;
62 }
63 ';
64 }
65
66
67 //hoverstyle
68 $css .= $root_selector . ':hover{';
69 //hover color
70 if (!empty($block['attrs']['blockAdvanceOptions']['hoverTextColor'])) {
71 $css .= 'color: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverTextColor'] ) . ';';
72 }
73
74 //hover background
75 if (!empty($block['attrs']['hoverBackgroundGradient'])) {
76 $css .= 'background: ' . esc_attr( $block['attrs']['hoverBackgroundGradient'] ) . ';';
77 } elseif (!empty($block['attrs']['hoverBackgroundColor'])) {
78 $css .= 'background:' . esc_attr( $block['attrs']['hoverBackgroundColor'] ) . ';';
79 } elseif (!empty($block['attrs']['blockAdvanceOptions']['hoverBackgroundGradient'])) {
80 $css .= 'background: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverBackgroundGradient'] ) . ';';
81 } elseif (!empty($block['attrs']['blockAdvanceOptions']['hoverBackgroundColor'])) {
82 $css .= 'background:' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverBackgroundColor'] ) . ';';
83 } else {
84 $css .= '';
85 }
86
87 //hover border
88 if (!empty($block['attrs']['blockAdvanceOptions']['hoverBorderColor'])) {
89 $css .= 'border-color:' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverBorderColor'] ) . ';';
90 }
91 $css .= '}';
92
93
94
95
96
97
98 $handle = 'gutenify_' . str_replace('/', '_', $block['blockName']) . '_' . $block_id;
99 wp_add_inline_style($handle, $css);
100 return $block_content;
101 }
102 }
103
104 Testimonials::init();
105
106