Skip to content

Commit

Permalink
PHP linting things
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Nov 25, 2024
1 parent d322c4f commit 136c0d2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 39 deletions.
78 changes: 42 additions & 36 deletions lib/compat/wordpress-6.8/block-bindings/site.php
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' );
6 changes: 3 additions & 3 deletions packages/block-library/src/site-title/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* @return string The render.
*/
function render_block_core_site_title( $attributes ) {
if ( ! isset( $attributes['content'] ) ) {
if ( ! isset( $attributes['content'] ) ) {
return;
}

$site_title = $attributes['content'];
$tag_name = 'h1';
$classes = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
$tag_name = 'h1';
$classes = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
$classes .= ' has-link-color';
}
Expand Down

0 comments on commit 136c0d2

Please sign in to comment.