Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/14/2021 09:19:32 PM (5 years ago)
Author:
imath
Message:

Merge the BP Blocks plugin's 'bp/recent-posts' Block

  • Adapt Grunt sass tasks.
  • Add the Block JavaScript source files into src/js/bp-blogs/js/blocks.
  • Add the Block Scss source file into src/bp-blogs/sass.
  • Generate the development files to ease testing.

Fixes #8526

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/classes/class-bp-blogs-component.php

    r12994 r13006  
    8282                        'global_tables'         => $global_tables,
    8383                        'meta_tables'           => $meta_tables,
     84                        'block_globals'         => array(
     85                                'bp/recent-posts' => array(
     86                                        'widget_classnames' => array( 'widget_bp_blogs_widget', 'buddypress' ),
     87                                ),
     88                        ),
    8489                );
    8590
    … …  
    137142                if ( is_multisite() ) {
    138143                        $includes[] = 'widgets';
     144                        $includes[] = 'blocks';
    139145                }
    140146
    … …  
    390396         */
    391397        public function blocks_init( $blocks = array() ) {
    392                 parent::blocks_init( array() );
     398                $blocks = array();
     399
     400                if ( is_multisite() ) {
     401                        $blocks['bp/recent-posts'] = array(
     402                                'name'               => 'bp/recent-posts',
     403                                'editor_script'      => 'bp-recent-posts-block',
     404                                'editor_script_url'  => plugins_url( 'js/blocks/recent-posts.js', dirname( __FILE__ ) ),
     405                                'editor_script_deps' => array(
     406                                        'wp-blocks',
     407                                        'wp-element',
     408                                        'wp-components',
     409                                        'wp-i18n',
     410                                        'wp-block-editor',
     411                                        'bp-block-components',
     412                                ),
     413                                'style'              => 'bp-recent-posts-block',
     414                                'style_url'          => plugins_url( 'css/blocks/recent-posts.css', dirname( __FILE__ ) ),
     415                                'attributes'         => array(
     416                                        'title'     => array(
     417                                                'type'    => 'string',
     418                                                'default' => __( 'Recent Networkwide Posts', 'buddypress' ),
     419                                        ),
     420                                        'maxPosts'  => array(
     421                                                'type'    => 'number',
     422                                                'default' => 10,
     423                                        ),
     424                                        'linkTitle' => array(
     425                                                'type'    => 'boolean',
     426                                                'default' => false,
     427                                        ),
     428                                ),
     429                                'render_callback'    => 'bp_blogs_render_recent_posts_block',
     430                        );
     431                }
     432
     433                parent::blocks_init( $blocks );
    393434        }
    394435}
Note: See TracChangeset for help on using the changeset viewer.