equal
deleted
inserted
replaced
187 $source_properties |
187 $source_properties |
188 ); |
188 ); |
189 |
189 |
190 $this->sources[ $source_name ] = $source; |
190 $this->sources[ $source_name ] = $source; |
191 |
191 |
192 // Adds `uses_context` defined by block bindings sources. |
|
193 add_filter( |
|
194 'get_block_type_uses_context', |
|
195 function ( $uses_context, $block_type ) use ( $source ) { |
|
196 if ( ! in_array( $block_type->name, $this->supported_blocks, true ) || empty( $source->uses_context ) ) { |
|
197 return $uses_context; |
|
198 } |
|
199 // Use array_values to reset the array keys. |
|
200 return array_values( array_unique( array_merge( $uses_context, $source->uses_context ) ) ); |
|
201 }, |
|
202 10, |
|
203 2 |
|
204 ); |
|
205 |
|
206 return $source; |
192 return $source; |
207 } |
193 } |
208 |
194 |
209 /** |
195 /** |
210 * Unregisters a block bindings source. |
196 * Unregisters a block bindings source. |