PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / trunk
Gutenify – Visual Site Builder Blocks & Starter Templates vtrunk
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 1.1.5 1.1.6 All 72 releases
gutenify / core / dist / blocks / team / index.php

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

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