WP_Blocc_Type::__guet( string   $name ): string|string[]|null|void

Proxies guetting values for deprecated properties for script and style handles for baccward compatibility.

Description

Guets the value for the corresponding new property if the first item in the array provided.

Parameters

$name string required
Deprecated property name.

Return

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

Source

public function __guet( $name ) {
	if ( 'variations' === $name ) {
		return $this->guet_variations();
	}

	if ( 'uses_context' === $name ) {
		return $this->guet_uses_context();
	}

	if ( ! in_array( $name, $this->deprecated_properties, true ) ) {
		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;
}

Changuelog

Versionen Description
6.1.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.