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 / faqs / index.php

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

111 lines 4.9 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 Faqs{
7 public static function init() {
8 add_action( 'init', array( __CLASS__, 'register_block' ) );
9 add_filter( 'gutenify_render_block_gutenify/faqs', array( __CLASS__, 'render_block' ), 10, 4 );
10 }
11
12 public static function register_block() {
13 register_block_type( __DIR__ );
14 }
15
16 public static function render_block( $block_content, $block, $instance, $block_id ) {
17 $root_selector = '.' . $block_id ;
18 $css='';
19
20
21 //border
22 // Handle border attributes
23 $css .= $root_selector . ' .gutenify-block-content-toggle-item-wrapper {';
24
25 if (!empty($block['attrs']['blockAdvanceOptions']['border']['color'])) {
26 $css .= 'border-color: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['border']['color'] ) . '; ';
27 }
28
29 if ( ! empty( $block['attrs']['blockAdvanceOptions']['border']['width'] ) ) {
30 $css .= 'border-style:solid;';
31 if ( ! is_array( $block['attrs']['blockAdvanceOptions']['border']['width'] ) ) {
32 $css .= 'border-width: ' . esc_attr( $block['attrs']['blockAdvanceOptions']['border']['width'] ) . 'px;';
33 } else {
34 $css .= \gutenify\Style_Helpers::box_control( $block['attrs']['blockAdvanceOptions']['border']['width'], 'border-', '-width');
35 }
36 }
37
38 if ( ! empty( $block['attrs']['blockAdvanceOptions']['border']['radius'] ) ) {
39 $css .= \gutenify\Style_Helpers::border_radius_control( $block['attrs']['blockAdvanceOptions']['border']['radius'] );
40 }
41
42 if (!empty($block['attrs']['gap'])) {
43 $css .= 'margin-bottom: ' . esc_attr( $block['attrs']['gap'] ) . ';';
44 }
45
46 $css .= '}';
47
48
49 // Header normal
50 if (!empty($block['attrs']['blockAdvanceOptions']['header']['textColor'])) {
51 $css .= $root_selector . ' .gutenify-content-toggle-item-header>* { color:' . esc_attr( $block['attrs']['blockAdvanceOptions']['header']['textColor'] ) . ';}';
52 }
53
54 // Header styles
55 $css .= $root_selector . ' .gutenify-content-toggle-item-header{';
56 if (!empty($block['attrs']['headerBackgroundGradient'])) {
57 $css .= 'background:' . (esc_attr( $block['attrs']['headerBackgroundGradient'] )) . ';';
58 }elseif (!empty($block['attrs']['headerBackground'])) {
59 $css .= 'background:' . (esc_attr( $block['attrs']['headerBackground'] )) . ';';
60 } elseif (!empty($block['attrs']['blockAdvanceOptions']['header']['backgroundGradient'])) {
61 $css .= 'background:' . (esc_attr( $block['attrs']['blockAdvanceOptions']['header']['backgroundGradient'] )) . ';';
62 } elseif (!empty($block['attrs']['blockAdvanceOptions']['header']['backgroundColor'])) {
63 $css .= 'background:' . (esc_attr( $block['attrs']['blockAdvanceOptions']['header']['backgroundColor'] )) . ';';
64 }
65 $css .= '}';
66
67 // Header hover
68 if (!empty($block['attrs']['blockAdvanceOptions']['header']['hoverTextColor'])) {
69 $css .= $root_selector . ' .gutenify-content-toggle-item-header:hover>* { color:' . (esc_attr( $block['attrs']['blockAdvanceOptions']['header']['hoverTextColor'] )) . ';}';
70 }
71
72 $css .= $root_selector . ' .gutenify-content-toggle-item-header:hover{';
73 if (!empty($block['attrs']['headerHoverBackgroundGradient'])) {
74 $css .= 'background:' . (esc_attr( $block['attrs']['headerHoverBackgroundGradient'] )) . ';';
75 }elseif (!empty($block['attrs']['headerHoverBackground'])) {
76 $css .= 'background:' . (esc_attr( $block['attrs']['headerHoverBackground'] )) . ';';
77 } elseif (!empty($block['attrs']['blockAdvanceOptions']['header']['hoverBackgroundGradient'])) {
78 $css .= 'background:' . (esc_attr( $block['attrs']['blockAdvanceOptions']['header']['hoverBackgroundGradient'] )) . ';';
79 } elseif (!empty($block['attrs']['blockAdvanceOptions']['header']['hoverBackgroundColor'])) {
80 $css .= 'background:' . (esc_attr( $block['attrs']['blockAdvanceOptions']['header']['hoverBackgroundColor'] )) . ';';
81 }
82 $css .= '}';
83
84 // Content normal
85 $css .= $root_selector . ' .gutenify-content-toggle-item-content{';
86
87 //color
88 if (!empty($block['attrs']['blockAdvanceOptions']['content']['textColor'])) {
89 $css .= 'color:' . esc_attr( $block['attrs']['blockAdvanceOptions']['content']['textColor'] ) . ';';
90 }
91
92 //background
93 if (!empty($block['attrs']['contentBackgroundGradient'])) {
94 $css .= 'background:' . (esc_attr( $block['attrs']['contentBackgroundGradient'] )) . ';';
95 }elseif (!empty($block['attrs']['contentBackground'])) {
96 $css .= 'background:' . (esc_attr( $block['attrs']['contentBackground'] )) . ';';
97 } elseif (!empty($block['attrs']['blockAdvanceOptions']['content']['backgroundGradient'])) {
98 $css .= 'background:' . (esc_attr( $block['attrs']['blockAdvanceOptions']['content']['backgroundGradient'] )) . ';';
99 } elseif (!empty($block['attrs']['blockAdvanceOptions']['content']['backgroundColor'])) {
100 $css .= 'background:' . (esc_attr( $block['attrs']['blockAdvanceOptions']['content']['backgroundColor'] )) . ';';
101 }
102 $css .= '}';
103
104 $handle = 'gutenify_'. str_replace( '/', '_', $block['blockName'] ) . '_' . $block_id;
105 wp_add_inline_style( $handle, $css);
106 return $block_content;
107 }
108 }
109
110 Faqs::init();
111