Skip to:
Content

BuddyPress.org

Changeset 12747


Ignore:
Timestamp:
10/10/2020 06:06:52 PM (5 years ago)
Author:
imath
Message:

BP Blocks: introduce the first BP Activity Block 🙌

To use this block, you simply need to paste the permalink of a single activity to embed it the block's placeholder. It will include the activity embed into your post or page.

Props espellcaste, imath

See #8369

Location:
trunk/src
Files:
11 added
1 edited

Legend:

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

    r12586 r12747  
    5656            'template',
    5757            'functions',
    58             'cache'
     58            'cache',
     59            'blocks',
    5960        );
    6061
     
    473474        parent::rest_api_init( array( 'BP_REST_Activity_Endpoint' ) );
    474475    }
     476
     477    /**
     478     * Register the BP Activity Blocks.
     479     *
     480     * @since 7.0.0
     481     *
     482     * @param array $blocks Optional. See BP_Component::blocks_init() for
     483     *                      description.
     484     */
     485    public function blocks_init( $blocks = array() ) {
     486        parent::blocks_init(
     487            array(
     488                'bp/embed-activity' => array(
     489                    'name'               => 'bp/embed-activity',
     490                    'editor_script'      => 'bp-embed-activity-block',
     491                    'editor_script_url'  => plugins_url( 'js/blocks/embed-activity.js', dirname(  __FILE__ ) ),
     492                    'editor_script_deps' => array(
     493                        'wp-blocks',
     494                        'wp-element',
     495                        'wp-i18n',
     496                        'wp-components',
     497                        'wp-block-editor',
     498                        'wp-data',
     499                        'wp-compose',
     500                    ),
     501                ),
     502            )
     503        );
     504    }
    475505}
Note: See TracChangeset for help on using the changeset viewer.