k bindings source names must contain a namespace prefix. Example: my-plugin/my-custom-source' ), '6.5.0' ); return false; } if ( $this->is_registered( $source_name ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Block bindings source name. */ sprintf( __( 'Block bindings source "%s" already registered.' ), $source_name ), '6.5.0' ); return false; } // Validates that the source properties contain the label. if ( ! isset( $source_properties['label'] ) ) { _doing_it_wrong( __METHOD__, __( 'The $source_properties must contain a "label".' ), '6.5.0' ); return false; } // Validates that the source properties contain the get_value_callback. if ( ! isset( $source_properties['get_value_callback'] ) ) { _doing_it_wrong( __METHOD__, __( 'The $source_properties must contain a "get_value_callback".' ), '6.5.0' ); return false; } // Validates that the get_value_callback is a valid callback. if ( ! is_callable( $source_properties['get_value_callback'] ) ) { _doing_it_wrong( __METHOD__, __( 'The "get_value_callback" parameter must be a valid callback.' ), '6.5.0' ); return false; } // Validates that the uses_context parameter is an array. if ( isset( $source_properties['uses_context'] ) && ! is_array( $source_properties['uses_context'] ) ) { _doing_it_wrong( __METHOD__, __( 'The "uses_context" parameter must be an array.' ), '6.5.0' ); return false; } if ( ! empty( array_diff( array_keys( $source_properties ), $this->allowed_source_properties ) ) ) { _doing_it_wrong( __METHOD__, __( 'The $source_properties array contains invalid properties.' ), '6.5.0' ); return false; } $source = new WP_Block_Bindings_Source( $source_name, $source_properties ); $this->sources[ $source_name ] = $source; return $source; } /** * Unregisters a block bindings source. * * @since 6.5.0 * * @param string $source_name Block bindings source name including namespace. * @return WP_Block_Bindings_Source|false The unregistered block bindings source on success and `false` otherwise. */ public function unregister( string $source_name ) { if ( ! $this->is_registered( $source_name ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Block bindings source name. */ sprintf( __( 'Block binding "%s" not found.' ), $source_name ), '6.5.0' ); return false; } $unregistered_source = $this->sources[ $source_name ]; unset( $this->sources[ $source_name ] ); return $unregistered_source; } /** * Retrieves the list of all registered block bindings sources. * * @since 6.5.0 * * @return WP_Block_Bindings_Source[] The array of registered sources. */ public function get_all_registered() { return $this->sources; } /** * Retrieves a registered block bindings source. * * @since 6.5.0 * * @param string $source_name The name of the source. * @return WP_Block_Bindings_Source|null The registered block bindings source, or `null` if it is not registered. */ public function get_registered( string $source_name ) { if ( ! $this->is_registered( $source_name ) ) { return null; } return $this->sources[ $source_name ]; } /** * Checks if a block bindings source is registered. * * @since 6.5.0 * * @param string $source_name The name of the source. * @return bool `true` if the block bindings source is registered, `false` otherwise. */ public function is_registered( $source_name ) { return isset( $this->sources[ $source_name ] ); } /** * Wakeup magic method. * * @since 6.5.0 */ public function __wakeup() { if ( ! $this->sources ) { return; } if ( ! is_array( $this->sources ) ) { throw new UnexpectedValueException(); } foreach ( $this->sources as $value ) { if ( ! $value instanceof WP_Block_Bindings_Source ) { throw new UnexpectedValueException(); } } } /** * Utility method to retrieve the main instance of the class. * * The instance will be created if it does not exist yet. * * @since 6.5.0 * * @return WP_Block_Bindings_Registry The main instance. */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } }
Fatal error: Uncaught Error: Class "WP_Block_Bindings_Registry" not found in /htdocs/wp-includes/block-bindings.php:95 Stack trace: #0 /htdocs/wp-includes/block-bindings/pattern-overrides.php(40): register_block_bindings_source('core/pattern-ov...', Array) #1 /htdocs/wp-includes/class-wp-hook.php(324): _register_block_bindings_pattern_overrides_source('') #2 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #3 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /htdocs/wp-settings.php(704): do_action('init') #5 /htdocs/wp-config.php(178): require_once('/htdocs/wp-sett...') #6 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #7 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #8 /htdocs/index.php(17): require('/htdocs/wp-blog...') #9 {main} thrown in /htdocs/wp-includes/block-bindings.php on line 95