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.

Метод класса: WP_Block_Type{}

Хуков нет.

Возвращает

Строку|Строку[]|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.

Использование

$WP_Block_Type = new WP_Block_Type();
$WP_Block_Type->__get( $name );
$name(строка) (обязательный)
Deprecated property name.

Список изменений

С версии 6.1.0 Введена.

Код 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;
}