PHP 8.3.27
Preview: custom-classname.php Size: 1.63 KB
/home7/doctorbruno/public_html/siddharastrology.com/wp-includes/block-supports/custom-classname.php
<?php
/**
 * Custom classname block support flag.
 *
 * @package WordPress
 * @since 5.6.0
 */

/**
 * Registers the custom classname block attribute for block types that support it.
 *
 * @since 5.6.0
 * @access private
 *
 * @param WP_Block_Type $block_type Block Type.
 */
function wp_register_custom_classname_support( $block_type ) {
	$has_custom_classname_support = block_has_support( $block_type, 'customClassName', true );

	if ( $has_custom_classname_support ) {
		if ( ! $block_type->attributes ) {
			$block_type->attributes = array();
		}

		if ( ! array_key_exists( 'className', $block_type->attributes ) ) {
			$block_type->attributes['className'] = array(
				'type' => 'string',
			);
		}
	}
}

/**
 * Adds the custom classnames to the output.
 *
 * @since 5.6.0
 * @access private
 *
 * @param  WP_Block_Type $block_type       Block Type.
 * @param  array         $block_attributes Block attributes.
 * @return array Block CSS classes and inline styles.
 */
function wp_apply_custom_classname_support( $block_type, $block_attributes ) {
	$has_custom_classname_support = block_has_support( $block_type, 'customClassName', true );
	$attributes                   = array();
	if ( $has_custom_classname_support ) {
		$has_custom_classnames = array_key_exists( 'className', $block_attributes );

		if ( $has_custom_classnames ) {
			$attributes['class'] = $block_attributes['className'];
		}
	}

	return $attributes;
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
	'custom-classname',
	array(
		'register_attribute' => 'wp_register_custom_classname_support',
		'apply'              => 'wp_apply_custom_classname_support',
	)
);

Directory Contents

Dirs: 0 × Files: 25
Name Size Perms Modified Actions
1.67 KB lrw-r--r-- 2023-11-07 21:28:55
Edit Download
1.54 KB lrw-r--r-- 2026-01-06 03:42:33
Edit Download
1.65 KB lrw-r--r-- 2026-08-20 16:35:09
Edit Download
2.18 KB lrw-r--r-- 2026-02-18 03:35:42
Edit Download
4.75 KB lrw-r--r-- 2026-09-09 04:36:04
Edit Download
9.70 KB lrw-r--r-- 2026-09-24 04:33:21
Edit Download
4.01 KB lrw-r--r-- 2026-07-23 16:36:54
Edit Download
6.10 KB lrw-r--r-- 2026-01-06 03:42:33
Edit Download
5.97 KB lrw-r--r-- 2026-09-09 04:36:04
Edit Download
1.63 KB lrw-r--r-- 2026-08-20 16:35:09
Edit Download
10.04 KB lrw-r--r-- 2026-09-22 10:40:12
Edit Download
5.83 KB lrw-r--r-- 2026-09-09 04:36:04
Edit Download
2.67 KB lrw-r--r-- 2024-07-17 04:29:23
Edit Download
9.29 KB lrw-r--r-- 2026-09-09 04:36:04
Edit Download
1.46 MB lrw-r--r-- 2026-10-06 20:25:58
Edit Download
1.70 KB lrw-r--r-- 2023-11-07 21:28:55
Edit Download
44 B lrw-r--r-- 2026-10-02 10:08:26
Edit Download
61.82 KB lrw-r--r-- 2026-09-24 04:33:21
Edit Download
6.79 KB lrw-r--r-- 2026-09-26 04:33:03
Edit Download
4.43 KB lrw-r--r-- 2026-09-09 04:36:05
Edit Download
2.04 KB lrw-r--r-- 2026-09-09 04:36:04
Edit Download
2.68 KB lrw-r--r-- 2026-01-06 03:42:33
Edit Download
21.63 KB lrw-r--r-- 2026-09-05 04:37:50
Edit Download
28.90 KB lrw-r--r-- 2026-10-05 19:42:06
Edit Download
1008 B lrw-r--r-- 2026-08-20 16:35:09
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).