PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / 1.9.0
Gutenify – Visual Site Builder Blocks & Starter Templates v1.9.0
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 / testimonial / index.php

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

106 lines 3.6 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 Testimonial
7 {
8 public static function init()
9 {
10 add_action('init', array(__CLASS__, 'register_block'));
11 add_filter('gutenify_render_block_gutenify/testimonial', 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 //color
26 if (!empty($block['attrs']['blockAdvanceOptions']['textColor'])) {
27 $css .= 'color: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['textColor'] ) . ';';
28 }
29
30 //background
31 if (!empty($block['attrs']['backgroundGradient'])) {
32 $css .= 'background: ' . esc_attr( $block['attrs']['backgroundGradient'] ) . ';';
33 } elseif (!empty($block['attrs']['backgroundColor'])) {
34 $css .= 'background:' . esc_attr( $block['attrs']['backgroundColor'] ) . ';';
35 } elseif (!empty($block['attrs']['blockAdvanceOptions']['backgroundGradient'])) {
36 $css .= 'background:' . esc_attr( $block['attrs']['blockAdvanceOptions']['backgroundGradient'] ) . ';';
37 } elseif (!empty($block['attrs']['blockAdvanceOptions']['backgroundColor'])) {
38 $css .= 'background:' . esc_attr( $block['attrs']['blockAdvanceOptions']['backgroundColor'] ) . ';';
39 } else {
40 $css .= 'background: #ffffff;';
41 }
42
43
44
45 //border color
46 if (!empty($block['attrs']['blockAdvanceOptions']['borderColor'])) {
47 $css .= 'border-color: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['borderColor'] ) . ';';
48 }
49
50 //border width
51 if ( ! empty( $block['attrs']['blockAdvanceOptions']['borderWidth'] ) ) {
52 $css .= 'border-style:solid;';
53 $css .= \gutenify\Style_Helpers::box_control( $block['attrs']['blockAdvanceOptions']['borderWidth'], 'border-', '-width');
54 }
55
56 if ( ! empty( $block['attrs']['blockAdvanceOptions']['borderRadius'] ) ) {
57 $css .= \gutenify\Style_Helpers::border_radius_control( $block['attrs']['blockAdvanceOptions']['borderRadius'] );
58 }
59 $css .= '}';
60
61 if(!empty($block['attrs']['blockAdvanceOptions']['textColor'])){
62 $css .= $root_selector . ' :where(h1,h2,h3,h4,h5,h6){
63 color: inherit;
64 }
65 ';
66 }
67
68
69 //hoverstyle
70 $css .= $root_selector . ':hover{';
71
72 //hover color
73 if (!empty($block['attrs']['blockAdvanceOptions']['hoverTextColor'])) {
74 $css .= 'color: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverTextColor'] ) . ';';
75 }
76
77 //hover background
78 if (!empty($block['attrs']['hoverBackgroundGradient'])) {
79 $css .= 'background: ' . esc_attr( $block['attrs']['hoverBackgroundGradient'] ) . ';';
80 } elseif (!empty($block['attrs']['hoverBackgroundColor'])) {
81 $css .= 'background:' . esc_attr( $block['attrs']['hoverBackgroundColor'] ) . ';';
82 } elseif (!empty($block['attrs']['blockAdvanceOptions']['hoverBackgroundGradient'])) {
83 $css .= 'background: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverBackgroundGradient'] ) . ';';
84 } elseif (!empty($block['attrs']['blockAdvanceOptions']['hoverBackgroundColor'])) {
85 $css .= 'background:' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverBackgroundColor'] ) . ';';
86 } else {
87 $css .= '';
88 }
89
90
91 //hover border
92 if (!empty($block['attrs']['blockAdvanceOptions']['hoverBorderColor'])) {
93 $css .= 'border-color:' . esc_attr( $block['attrs']['blockAdvanceOptions']['hoverBorderColor'] ) . ';';
94 }
95 $css .= '}';
96
97
98
99 $handle = 'gutenify_' . str_replace('/', '_', $block['blockName']) . '_' . $block_id;
100 wp_add_inline_style($handle, $css);
101 return $block_content;
102 }
103 }
104
105 Testimonial::init();
106