diff --git a/lib/blocks.php b/lib/blocks.php index 8b29458e9c9dc..c4f4fb15d0652 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -137,7 +137,7 @@ function gutenberg_register_legacy_social_link_blocks() { 'type' => 'string', ), ), - 'render_callback' => 'gutenberg_render_core_social_link', + 'render_callback' => 'gutenberg_render_block_core_social_link', ) ); } diff --git a/packages/block-library/src/legacy-widget/index.php b/packages/block-library/src/legacy-widget/index.php index d0a91f3f6c619..39e88c29dc1c3 100644 --- a/packages/block-library/src/legacy-widget/index.php +++ b/packages/block-library/src/legacy-widget/index.php @@ -12,7 +12,7 @@ * * @return string Returns the rendered widget as a string. */ -function render_widget_by_id( $id ) { +function block_core_legacy_widget_render_widget_by_id( $id ) { // Code extracted from src/wp-includes/widgets.php dynamic_sidebar function. // Todo: When merging to core extract this part of dynamic_sidebar into its own function. global $wp_registered_widgets; @@ -71,7 +71,7 @@ function render_widget_by_id( $id ) { * * @return string Returns the post content with the legacy widget added. */ -function render_block_legacy_widget( $attributes ) { +function render_block_core_legacy_widget( $attributes ) { $id = null; $widget_class = null; if ( isset( $attributes['id'] ) ) { @@ -82,7 +82,7 @@ function render_block_legacy_widget( $attributes ) { } if ( $id ) { - return render_widget_by_id( $id ); + return block_core_legacy_widget_render_widget_by_id( $id ); } if ( ! $widget_class ) { return ''; @@ -121,7 +121,7 @@ function register_block_core_legacy_widget() { 'type' => 'object', ), ), - 'render_callback' => 'render_block_legacy_widget', + 'render_callback' => 'render_block_core_legacy_widget', ) ); } diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index 1e57dd3e02b4c..355aa989701cd 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -12,7 +12,7 @@ * @param array $attributes Navigation block attributes. * @return array Colors CSS classes and inline styles. */ -function core_block_navigation_build_css_colors( $attributes ) { +function block_core_navigation_build_css_colors( $attributes ) { $colors = array( 'css_classes' => array(), 'inline_styles' => '', @@ -64,7 +64,7 @@ function core_block_navigation_build_css_colors( $attributes ) { * @param array $attributes Navigation block attributes. * @return array Font size CSS classes and inline styles. */ -function core_block_navigation_build_css_font_sizes( $attributes ) { +function block_core_navigation_build_css_font_sizes( $attributes ) { // CSS classes. $font_sizes = array( 'css_classes' => array(), @@ -91,7 +91,7 @@ function core_block_navigation_build_css_font_sizes( $attributes ) { * @param array $blocks Navigation link inner blocks from the Navigation block. * @return array Blocks that had valid labels */ -function core_block_navigation_empty_navigation_links_recursive( $blocks ) { +function block_core_navigation_empty_navigation_links_recursive( $blocks ) { $blocks = array_filter( $blocks, function( $block ) { @@ -102,7 +102,7 @@ function( $block ) { if ( ! empty( $blocks ) ) { foreach ( $blocks as $key => $block ) { if ( ! empty( $block['innerBlocks'] ) ) { - $blocks[ $key ]['innerBlocks'] = core_block_navigation_empty_navigation_links_recursive( $block['innerBlocks'] ); + $blocks[ $key ]['innerBlocks'] = block_core_navigation_empty_navigation_links_recursive( $block['innerBlocks'] ); } } } @@ -115,7 +115,7 @@ function( $block ) { * * @return string */ -function core_block_navigation_render_submenu_icon() { +function block_core_navigation_render_submenu_icon() { return ''; } @@ -127,13 +127,13 @@ function core_block_navigation_render_submenu_icon() { * * @return string Returns the post content with the legacy widget added. */ -function render_block_navigation( $content, $block ) { +function render_block_core_navigation( $content, $block ) { if ( 'core/navigation' !== $block['blockName'] ) { return $content; } - $block['innerBlocks'] = core_block_navigation_empty_navigation_links_recursive( $block['innerBlocks'] ); + $block['innerBlocks'] = block_core_navigation_empty_navigation_links_recursive( $block['innerBlocks'] ); $attributes = $block['attrs']; /** @@ -157,8 +157,8 @@ function render_block_navigation( $content, $block ) { return ''; } - $colors = core_block_navigation_build_css_colors( $attributes ); - $font_sizes = core_block_navigation_build_css_font_sizes( $attributes ); + $colors = block_core_navigation_build_css_colors( $attributes ); + $font_sizes = block_core_navigation_build_css_font_sizes( $attributes ); $classes = array_merge( $colors['css_classes'], $font_sizes['css_classes'], @@ -176,7 +176,7 @@ function render_block_navigation( $content, $block ) { '', $class_attribute, $style_attribute, - core_block_navigation_build_html( $attributes, $block, $colors, $font_sizes, true ) + block_core_navigation_build_html( $attributes, $block, $colors, $font_sizes, true ) ); } @@ -190,7 +190,7 @@ function render_block_navigation( $content, $block ) { * * @return string Returns an HTML list from innerBlocks. */ -function core_block_navigation_build_html( $attributes, $block, $colors, $font_sizes ) { +function block_core_navigation_build_html( $attributes, $block, $colors, $font_sizes ) { $html = ''; $classes = array_merge( $colors['css_classes'], @@ -257,14 +257,14 @@ function core_block_navigation_build_html( $attributes, $block, $colors, $font_s ) && $has_submenu ) { - $html .= '' . core_block_navigation_render_submenu_icon() . ''; + $html .= '' . block_core_navigation_render_submenu_icon() . ''; } $html .= ''; // End anchor tag content. if ( $has_submenu ) { - $html .= core_block_navigation_build_html( $attributes, $block, $colors, $font_sizes, false ); + $html .= block_core_navigation_build_html( $attributes, $block, $colors, $font_sizes, false ); } $html .= ''; @@ -275,7 +275,7 @@ function core_block_navigation_build_html( $attributes, $block, $colors, $font_s /** * Register the navigation block. * - * @uses render_block_navigation() + * @uses render_block_core_navigation() * @throws WP_Error An WP_Error exception parsing the block definition. */ function register_block_core_navigation() { @@ -325,4 +325,4 @@ function register_block_core_navigation() { ); } add_action( 'init', 'register_block_core_navigation' ); -add_filter( 'render_block', 'render_block_navigation', 10, 2 ); +add_filter( 'render_block', 'render_block_core_navigation', 10, 2 ); diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index 20940f389a518..5db4268a5d1e8 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -12,17 +12,17 @@ * * @return string Rendered HTML of the referenced block. */ -function render_core_social_link( $attributes ) { +function render_block_core_social_link( $attributes ) { $service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon'; $url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false; - $label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : __( 'Link to ' ) . core_social_link_get_name( $service ); + $label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : __( 'Link to ' ) . block_core_social_link_get_name( $service ); // Don't render a link if there is no URL set. if ( ! $url ) { return ''; } - $icon = core_social_link_get_icon( $service ); + $icon = block_core_social_link_get_icon( $service ); return ''; } @@ -38,7 +38,7 @@ function register_block_core_social_link() { array_merge( $metadata, array( - 'render_callback' => 'render_core_social_link', + 'render_callback' => 'render_block_core_social_link', ) ) ); @@ -53,8 +53,8 @@ function register_block_core_social_link() { * * @return string SVG Element for site icon. */ -function core_social_link_get_icon( $site ) { - $sites = core_social_link_sites(); +function block_core_social_link_get_icon( $site ) { + $sites = block_core_social_link_sites(); if ( isset( $sites[ $site ] ) && isset( $sites[ $site ]['icon'] ) ) { return $sites[ $site ]['icon']; } @@ -69,8 +69,8 @@ function core_social_link_get_icon( $site ) { * * @return string Brand label. */ -function core_social_link_get_name( $site ) { - $sites = core_social_link_sites(); +function block_core_social_link_get_name( $site ) { + $sites = block_core_social_link_sites(); if ( isset( $sites[ $site ] ) && isset( $sites[ $site ]['name'] ) ) { return $sites[ $site ]['name']; } @@ -86,7 +86,7 @@ function core_social_link_get_name( $site ) { * * @return array|string */ -function core_social_link_sites( $site = '', $field = '' ) { +function block_core_social_link_sites( $site = '', $field = '' ) { $sites_data = array( 'fivehundredpx' => array( 'name' => '500px',