PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / extend / deprecated / custom-css / index.php

index.php in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/extend/deprecated/custom-css/index.php

51 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Deprecated Custom CSS Extension.
4 *
5 * @since v3.1.0
6 *
7 * @package ghostkit
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 /**
15 * Class GhostKit_Deprecated_Extension_Custom_CSS
16 */
17 class GhostKit_Deprecated_Extension_Custom_CSS {
18 /**
19 * GhostKit_Deprecated_Extension_Custom_CSS constructor.
20 */
21 public function __construct() {
22 add_filter( 'gkt_block_custom_styles', array( $this, 'block_custom_styles' ), 10, 2 );
23 }
24
25 /**
26 * Get styles from block attribute.
27 *
28 * @param string $blocks_css - block css.
29 * @param array $block - block data.
30 *
31 * @return string - ready to use styles string.
32 */
33 public function block_custom_styles( $blocks_css, $block ) {
34 $attributes = $block['attrs'] ?? array();
35
36 $id = $attributes['ghostkit']['id'] ?? $attributes['ghostkitId'] ?? '';
37
38 if ( $id && ! empty( $attributes['ghostkitCustomCSS'] ) ) {
39 if ( ! empty( $blocks_css ) ) {
40 $blocks_css .= ' ';
41 }
42
43 $blocks_css .= str_replace( 'selector', '.ghostkit-custom-' . $id, ghostkit_decode( $attributes['ghostkitCustomCSS'] ) );
44 }
45
46 return $blocks_css;
47 }
48 }
49
50 new GhostKit_Deprecated_Extension_Custom_CSS();
51