# ghostkit/3.3.2/gutenberg/extend/deprecated/custom-css/index.php

Block Animations, Motion &amp; Scroll Effects – Ghost Kit, version 3.3.2. 51 lines.

- Page: https://pluginprobe.com/plugins/ghostkit/3.3.2/code/gutenberg/extend/deprecated/custom-css/index.php
- Raw: https://pluginprobe.com/plugins/ghostkit/3.3.2/raw/gutenberg/extend/deprecated/custom-css/index.php
- Modified: 2024-02-18T18:40:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ghostkit/3.3.2/code/gutenberg/extend/deprecated/custom-css/index.php#L10-L20`.

```php
<?php
/**
 * Deprecated Custom CSS Extension.
 *
 * @since v3.1.0
 *
 * @package ghostkit
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class GhostKit_Deprecated_Extension_Custom_CSS
 */
class GhostKit_Deprecated_Extension_Custom_CSS {
	/**
	 * GhostKit_Deprecated_Extension_Custom_CSS constructor.
	 */
	public function __construct() {
		add_filter( 'gkt_block_custom_styles', array( $this, 'block_custom_styles' ), 10, 2 );
	}

	/**
	 * Get styles from block attribute.
	 *
	 * @param string $blocks_css - block css.
	 * @param array  $block - block data.
	 *
	 * @return string - ready to use styles string.
	 */
	public function block_custom_styles( $blocks_css, $block ) {
		$attributes = $block['attrs'] ?? array();

		$id = $attributes['ghostkit']['id'] ?? $attributes['ghostkitId'] ?? '';

		if ( $id && ! empty( $attributes['ghostkitCustomCSS'] ) ) {
			if ( ! empty( $blocks_css ) ) {
				$blocks_css .= ' ';
			}

			$blocks_css .= str_replace( 'selector', '.ghostkit-custom-' . $id, ghostkit_decode( $attributes['ghostkitCustomCSS'] ) );
		}

		return $blocks_css;
	}
}

new GhostKit_Deprecated_Extension_Custom_CSS();

```
