WP_Block_Type::__get()publicWP 6.1.0

Proxies getting values for deprecated properties for script and style handles for backward compatibility. Gets the value for the corresponding new property if the first item in the array provided.

{} It's a method of the class: WP_Block_Type{}

No Hooks.

Return

String|String[]|null|null. The value read from the new property if the first item in the array provided, null when value not found, or void when unknown property name provided.

Usage

$WP_Block_Type = new WP_Block_Type();
$WP_Block_Type->__get( $name );
$name(string) (required)
Deprecated property name.

Changelog

Since 6.1.0 Introduced.

Code of WP_Block_Type::__get() WP 6.1.1

public function __get( $name ) {
	if ( ! in_array( $name, $this->deprecated_properties ) ) {
		return;
	}

	$new_name = $name . '_handles';

	if ( ! property_exists( $this, $new_name ) || ! is_array( $this->{$new_name} ) ) {
		return null;
	}

	if ( count( $this->{$new_name} ) > 1 ) {
		return $this->{$new_name};
	}
	return isset( $this->{$new_name}[0] ) ? $this->{$new_name}[0] : null;
}