PHP 8.1.33
Preview: custom-classname.php Size: 1.64 KB
/home/jambtst2015/public_html/cccng.org/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: 20

Name Size Perms Modified Actions
1.67 KB lrw-r--r-- 2023-08-11 02:18:20
Edit Download
1.57 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
4.02 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
9.20 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
6.27 KB lrw-r--r-- 2023-09-29 19:50:30
Edit Download
5.81 KB lrw-r--r-- 2023-09-29 19:50:30
Edit Download
1.64 KB lrw-r--r-- 2023-08-11 02:18:20
Edit Download
5.28 KB lrw-r--r-- 2024-01-31 13:24:18
Edit Download
2.67 KB lrw-r--r-- 2024-06-04 11:18:18
Edit Download
8.46 KB lrw-r--r-- 2024-05-03 14:55:12
Edit Download
1.21 KB lrw-r--r-- 2025-10-12 01:23:34
Edit Download
1.70 KB lrw-r--r-- 2023-08-11 02:18:20
Edit Download
38.50 KB lrw-r--r-- 2025-10-08 17:06:31
Edit Download
4.24 KB lrw-r--r-- 2023-09-26 23:17:20
Edit Download
4.52 KB lrw-r--r-- 2023-09-26 23:17:20
Edit Download
2.04 KB lrw-r--r-- 2024-06-04 09:06:14
Edit Download
2.81 KB lrw-r--r-- 2023-09-26 23:17:20
Edit Download
28.13 KB lrw-r--r-- 2024-12-17 21:37:28
Edit Download
1011 B lrw-r--r-- 2023-08-19 02:59:20
Edit Download
65.71 KB lrw-r--r-- 2024-01-27 06:43:23
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).