Skip to:
Content

BuddyPress.org

Changeset 12580


Ignore:
Timestamp:
03/25/2020 07:47:37 AM (5 years ago)
Author:
imath
Message:

Introduce the BP Group Block

It uses the BP Blocks API to register a block to let site owners feature one group of their community site. It includes Block settings to enable/disable some information such as the group profile photo, the group cover image, the group description and the group home page button.

See #8048

Location:
trunk/src/bp-groups
Files:
5 added
1 edited

Legend:

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

    r12485 r12580  
    131131            'notifications',
    132132            'cssjs',
     133            'blocks',
    133134        );
    134135
     
    941942        ) );
    942943    }
     944
     945    /**
     946     * Register the BP Groups Blocks.
     947     *
     948     * @since 6.0.0
     949     *
     950     * @param array $blocks Optional. See BP_Component::blocks_init() for
     951     *                      description.
     952     */
     953    public function blocks_init( $blocks = array() ) {
     954        parent::blocks_init(
     955            array(
     956                'bp/group' => array(
     957                    'name'               => 'bp/group',
     958                    'editor_script'      => 'bp-group-block',
     959                    'editor_script_url'  => plugins_url( 'js/blocks/group.js', dirname(  __FILE__ ) ),
     960                    'editor_script_deps' => array(
     961                        'wp-blocks',
     962                        'wp-element',
     963                        'wp-components',
     964                        'wp-i18n',
     965                        'wp-editor',
     966                        'wp-compose',
     967                        'wp-data',
     968                        'wp-block-editor',
     969                        'bp-block-components',
     970                    ),
     971                    'style'              => 'bp-group-block',
     972                    'style_url'          => plugins_url( 'css/blocks/group.css', dirname( __FILE__ ) ),
     973                    'render_callback'    => 'bp_groups_render_group_block',
     974                    'attributes'         => array(
     975                        'itemID'              => array(
     976                            'type'    => 'integer',
     977                            'default' => 0,
     978                        ),
     979                        'avatarSize'          => array(
     980                            'type'    => 'string',
     981                            'default' => 'full',
     982                        ),
     983                        'displayDescription'  => array(
     984                            'type'    => 'boolean',
     985                            'default' => true,
     986                        ),
     987                        'displayActionButton' => array(
     988                            'type'    => 'boolean',
     989                            'default' => true,
     990                        ),
     991                        'displayCoverImage'   => array(
     992                            'type'    => 'boolean',
     993                            'default' => true,
     994                        ),
     995                    ),
     996                ),
     997            )
     998        );
     999    }
    9431000}
Note: See TracChangeset for help on using the changeset viewer.