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.
$namestringrequired
public function __get( $name ) {
if ( 'variations' === $name ) {
return $this->get_variations();
}
if ( 'uses_context' === $name ) {
return $this->get_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;
}
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_block_type/__get