- Timestamp:
- 02/08/2024 08:55:18 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-bindings-registry.php
r57560 r57562 21 21 * 22 22 * @since 6.5.0 23 * @var array23 * @var WP_Block_Bindings_Source[] 24 24 */ 25 25 private $sources = array(); … … 67 67 * the block's original value, null, false to remove an attribute, etc. 68 68 * } 69 * @return array|false Source when the registration was successful, or `false` on failure.69 * @return WP_Block_Bindings_Source|false Source when the registration was successful, or `false` on failure. 70 70 */ 71 71 public function register( string $source_name, array $source_properties ) { … … 108 108 } 109 109 110 $source = array_merge( 111 array( 'name' => $source_name ), 110 /* Validate that the source properties contain the label */ 111 if ( ! isset( $source_properties['label'] ) ) { 112 _doing_it_wrong( 113 __METHOD__, 114 __( 'The $source_properties must contain a "label".' ), 115 '6.5.0' 116 ); 117 return false; 118 } 119 120 /* Validate that the source properties contain the get_value_callback */ 121 if ( ! isset( $source_properties['get_value_callback'] ) ) { 122 _doing_it_wrong( 123 __METHOD__, 124 __( 'The $source_properties must contain a "get_value_callback".' ), 125 '6.5.0' 126 ); 127 return false; 128 } 129 130 /* Validate that the get_value_callback is a valid callback */ 131 if ( ! is_callable( $source_properties['get_value_callback'] ) ) { 132 _doing_it_wrong( 133 __METHOD__, 134 __( 'The "get_value_callback" parameter must be a valid callback.' ), 135 '6.5.0' 136 ); 137 return false; 138 } 139 140 $source = new WP_Block_Bindings_Source( 141 $source_name, 112 142 $source_properties 113 143 ); … … 124 154 * 125 155 * @param string $source_name Block bindings source name including namespace. 126 * @return array|false The unregistered block bindings source on success and `false` otherwise.156 * @return WP_Block_Bindings_Source|false The unregistered block bindings source on success and `false` otherwise. 127 157 */ 128 158 public function unregister( string $source_name ) { … … 148 178 * @since 6.5.0 149 179 * 150 * @return arrayThe array of registered sources.180 * @return WP_Block_Bindings_Source[] The array of registered sources. 151 181 */ 152 182 public function get_all_registered() { … … 160 190 * 161 191 * @param string $source_name The name of the source. 162 * @return array|null The registered block bindings source, or `null` if it is not registered.192 * @return WP_Block_Bindings_Source|null The registered block bindings source, or `null` if it is not registered. 163 193 */ 164 194 public function get_registered( string $source_name ) {
Note: See TracChangeset
for help on using the changeset viewer.