-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,55 @@ | ||
<?php | ||
/** | ||
* Post Meta source for the block bindings. | ||
* Suite source for the block bindings. | ||
* | ||
* @since 6.5.0 | ||
* @since 6.8.0 | ||
* @package WordPress | ||
* @subpackage Block Bindings | ||
*/ | ||
|
||
/** | ||
* Gets value for Post Meta source. | ||
* | ||
* @since 6.5.0 | ||
* @access private | ||
* | ||
* @param array $source_args Array containing source arguments used to look up the override value. | ||
* Example: array( "key" => "foo" ). | ||
* @param WP_Block $block_instance The block instance. | ||
* @return mixed The value computed for the source. | ||
*/ | ||
function _block_bindings_site_get_value( array $source_args, $block_instance ) { | ||
if ( empty( $source_args['key'] ) ) { | ||
|
||
if ( ! function_exists( '_block_bindings_site_get_value' ) ) { | ||
/** | ||
* Gets value for Site source. | ||
* | ||
* @since 6.8.0 | ||
* @access private | ||
* | ||
* @param array $source_args Array containing source arguments used to look up the override value. | ||
* Example: array( "key" => "foo" ). | ||
* @param WP_Block $block_instance The block instance. | ||
* @return mixed The value computed for the source. | ||
*/ | ||
function _block_bindings_site_get_value( array $source_args ) { | ||
if ( empty( $source_args['key'] ) ) { | ||
return null; | ||
} | ||
|
||
if ( 'title' === $source_args['key'] ) { | ||
return esc_html( get_bloginfo( 'name' ) ); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
|
||
if ( $source_args['key'] === 'title' ) { | ||
return esc_html( get_bloginfo( 'name' ) ); | ||
|
||
if ( ! function_exists( '_register_block_bindings_site_source' ) ) { | ||
/** | ||
* Registers Site source in the block bindings registry. | ||
* | ||
* @since 6.8.0 | ||
* @access private | ||
*/ | ||
function _register_block_bindings_site_source() { | ||
register_block_bindings_source( | ||
'core/site', | ||
array( | ||
'label' => _x( 'Site', 'block bindings source' ), | ||
'get_value_callback' => '_block_bindings_site_get_value', | ||
) | ||
); | ||
} | ||
|
||
return null; | ||
add_action( 'init', '_register_block_bindings_site_source' ); | ||
} | ||
|
||
/** | ||
* Registers Post Meta source in the block bindings registry. | ||
* | ||
* @since 6.5.0 | ||
* @access private | ||
*/ | ||
function _register_block_bindings_site_source() { | ||
register_block_bindings_source( | ||
'core/site', | ||
array( | ||
'label' => _x( 'Site', 'block bindings source' ), | ||
'get_value_callback' => '_block_bindings_site_get_value', | ||
) | ||
); | ||
} | ||
|
||
add_action( 'init', '_register_block_bindings_site_source' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters