Skip to content

Commit

Permalink
Remove unnecessary gutenberg_ prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed May 24, 2019
1 parent 597de7f commit 300e1c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions lib/class-experimental-wp-widget-blocks-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class Experimental_WP_Widget_Blocks_Manager {

/**
* Array of sidebar_widgets as it was before the filter gutenberg_swap_out_sidebars_blocks_for_block_widgets was ever executed.
* Array of sidebar_widgets as it was before the filter swap_out_sidebars_blocks_for_block_widgets was ever executed.
*
* @var array
*/
Expand Down Expand Up @@ -59,7 +59,7 @@ public static function get_wp_registered_sidebars_sidebar( $sidebar_id ) {
}

/**
* Returns the result of wp_get_sidebars_widgets without gutenberg_swap_out_sidebars_blocks_for_block_widgets filter being applied.
* Returns the result of wp_get_sidebars_widgets without swap_out_sidebars_blocks_for_block_widgets filter being applied.
*
* @since 5.7.0
*/
Expand Down Expand Up @@ -299,7 +299,7 @@ public static function serialize_block( $block ) {
* @param array $options Widget options.
* @param array $arguments Arguments array.
*/
public static function gutenberg_output_blocks_widget( $options, $arguments ) {
public static function output_blocks_widget( $options, $arguments ) {
echo $options['before_widget'];
foreach ( $arguments['blocks'] as $block ) {
echo render_block( $block );
Expand All @@ -312,7 +312,7 @@ public static function gutenberg_output_blocks_widget( $options, $arguments ) {
*
* @param array $blocks Array of blocks.
*/
public static function gutenberg_blocks_to_widget( $blocks ) {
public static function convert_blocks_to_widget( $blocks ) {
$widget_id = 'blocks-widget-' . md5( Experimental_WP_Widget_Blocks_Manager::serialize_block( $blocks ) );
global $wp_registered_widgets;
if ( isset( $wp_registered_widgets[ $widget_id ] ) ) {
Expand All @@ -321,7 +321,7 @@ public static function gutenberg_blocks_to_widget( $blocks ) {
wp_register_sidebar_widget(
$widget_id,
__( 'Blocks Area ', 'gutenberg' ),
'Experimental_WP_Widget_Blocks_Manager::gutenberg_output_blocks_widget',
'Experimental_WP_Widget_Blocks_Manager::output_blocks_widget',
array(
'classname' => 'widget-area',
'description' => __( 'Displays a set of blocks', 'gutenberg' ),
Expand All @@ -338,7 +338,7 @@ public static function gutenberg_blocks_to_widget( $blocks ) {
*
* @param array $sidebars_widgets_input An associative array of sidebars and their widgets.
*/
public static function gutenberg_swap_out_sidebars_blocks_for_block_widgets( $sidebars_widgets_input ) {
public static function swap_out_sidebars_blocks_for_block_widgets( $sidebars_widgets_input ) {
global $sidebars_widgets;
if ( null === self::$unfiltered_sidebar_widgets ) {
self::$unfiltered_sidebar_widgets = $sidebars_widgets;
Expand All @@ -364,7 +364,7 @@ public static function gutenberg_swap_out_sidebars_blocks_for_block_widgets( $si
isset( $block['attrs']['identifier'] )
) {
if ( ! empty( $last_set_of_blocks ) ) {
$filtered_widgets[] = self::gutenberg_blocks_to_widget( $last_set_of_blocks );
$filtered_widgets[] = self::convert_blocks_to_widget( $last_set_of_blocks );
$last_set_of_blocks = array();
}
$filtered_widgets[] = $block['attrs']['identifier'];
Expand All @@ -373,7 +373,7 @@ public static function gutenberg_swap_out_sidebars_blocks_for_block_widgets( $si
}
}
if ( ! empty( $last_set_of_blocks ) ) {
$filtered_widgets[] = self::gutenberg_blocks_to_widget( $last_set_of_blocks );
$filtered_widgets[] = self::convert_blocks_to_widget( $last_set_of_blocks );
}

$filtered_sidebar_widgets[ $sidebar_id ] = $filtered_widgets;
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@ function gutenberg_create_wp_area_post_type() {
}
add_action( 'init', 'gutenberg_create_wp_area_post_type' );

add_filter( 'sidebars_widgets', 'Experimental_WP_Widget_Blocks_Manager::gutenberg_swap_out_sidebars_blocks_for_block_widgets' );
add_filter( 'sidebars_widgets', 'Experimental_WP_Widget_Blocks_Manager::swap_out_sidebars_blocks_for_block_widgets' );

0 comments on commit 300e1c2

Please sign in to comment.