Changeset 13464
- Timestamp:
- 04/25/2023 10:17:33 PM (20 months ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-component.php
r13455 r13464 556 556 * 557 557 * @since 7.0.0 558 * @since 12.0.0 Use the WP Blocks API v2. 558 559 * 559 560 * @param array $blocks Optional. See BP_Component::blocks_init() for … … 563 564 $blocks = array( 564 565 'bp/latest-activities' => array( 565 'name' => 'bp/latest-activities', 566 'editor_script' => 'bp-latest-activities-block', 567 'editor_script_url' => plugins_url( 'js/blocks/latest-activities.js', dirname( __FILE__ ) ), 568 'editor_script_deps' => array( 569 'wp-blocks', 570 'wp-element', 571 'wp-components', 572 'wp-i18n', 573 'wp-block-editor', 574 'wp-server-side-render', 575 'bp-block-data', 576 ), 577 'style' => 'bp-latest-activities-block', 578 'style_url' => plugins_url( 'css/blocks/latest-activities.css', dirname( __FILE__ ) ), 579 'attributes' => array( 580 'title' => array( 581 'type' => 'string', 582 'default' => __( 'Latest updates', 'buddypress' ), 583 ), 584 'maxActivities' => array( 585 'type' => 'number', 586 'default' => 5, 587 ), 588 'type' => array( 589 'type' => 'array', 590 'default' => array( 'activity_update' ), 591 ), 592 'postId' => array( 593 'type' => 'number', 594 'default' => 0, 595 ), 596 ), 597 'render_callback' => 'bp_activity_render_latest_activities_block', 566 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-activity/blocks/latest-activities', 567 'render_callback' => 'bp_activity_render_latest_activities_block', 598 568 ), 599 569 ); … … 601 571 if ( bp_is_active( $this->id, 'embeds' ) ) { 602 572 $blocks['bp/embed-activity'] = array( 603 'name' => 'bp/embed-activity', 604 'editor_script' => 'bp-embed-activity-block', 605 'editor_script_url' => plugins_url( 'js/blocks/embed-activity.js', dirname( __FILE__ ) ), 606 'editor_script_deps' => array( 607 'wp-blocks', 608 'wp-element', 609 'wp-i18n', 610 'wp-components', 611 'wp-block-editor', 612 'wp-data', 613 'wp-compose', 614 'bp-block-data', 615 ), 573 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-activity/blocks/embed-activity', 574 616 575 ); 617 576 } -
trunk/src/bp-blogs/classes/class-bp-blogs-component.php
r13455 r13464 511 511 * 512 512 * @since 9.0.0 513 * @since 12.0.0 Use the WP Blocks API v2. 513 514 * 514 515 * @param array $blocks Optional. See BP_Component::blocks_init() for … … 520 521 if ( is_multisite() && bp_is_active( 'activity' ) ) { 521 522 $blocks['bp/recent-posts'] = array( 522 'name' => 'bp/recent-posts', 523 'editor_script' => 'bp-recent-posts-block', 524 'editor_script_url' => plugins_url( 'js/blocks/recent-posts.js', dirname( __FILE__ ) ), 525 'editor_script_deps' => array( 526 'wp-blocks', 527 'wp-element', 528 'wp-components', 529 'wp-i18n', 530 'wp-block-editor', 531 'wp-server-side-render', 532 ), 533 'style' => 'bp-recent-posts-block', 534 'style_url' => plugins_url( 'css/blocks/recent-posts.css', dirname( __FILE__ ) ), 535 'attributes' => array( 536 'title' => array( 537 'type' => 'string', 538 'default' => __( 'Recent Networkwide Posts', 'buddypress' ), 539 ), 540 'maxPosts' => array( 541 'type' => 'number', 542 'default' => 10, 543 ), 544 'linkTitle' => array( 545 'type' => 'boolean', 546 'default' => false, 547 ), 548 ), 549 'render_callback' => 'bp_blogs_render_recent_posts_block', 523 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-blogs/blocks/recent-posts', 524 'render_callback' => 'bp_blogs_render_recent_posts_block', 550 525 ); 551 526 } -
trunk/src/bp-core/admin/bp-core-admin-functions.php
r13455 r13464 1457 1457 * @since 5.0.0 1458 1458 * @since 8.0.0 The `bp_block_category_post_types` filter has been deprecated. 1459 * @since 12.0.0 This category is left for third party plugin but not used anymmore. 1460 * 1461 * @todo deprecate. 1459 1462 * 1460 1463 * @param array $categories Array of block categories. … … 1477 1480 array( 1478 1481 'slug' => 'buddypress', 1479 'title' => __( ' BuddyPress', 'buddypress' ),1480 'icon' => 'buddicons- buddypress-logo',1482 'title' => __( 'Community blocks', 'buddypress' ), 1483 'icon' => 'buddicons-community', 1481 1484 ), 1482 1485 ) -
trunk/src/bp-core/bp-core-blocks.php
r13441 r13464 36 36 * @since 9.0.0 Adds a dependency to `wp-server-side-render` if WP >= 5.3. 37 37 * Uses a dependency to `wp-editor` otherwise. 38 * @since 12.0.0 Uses the `@wordpress/scripts` `index.asset.php` generated file to get dependencies. 38 39 */ 39 40 function bp_register_block_components() { 41 $asset = array( 42 'dependencies' => array(), 43 'version' => bp_get_version(), 44 ); 45 $asset_file = trailingslashit( dirname( __FILE__ ) ) . 'blocks/block-components/index.asset.php'; 46 47 if ( file_exists( $asset_file ) ) { 48 $asset = require $asset_file; 49 } 50 40 51 wp_register_script( 41 52 'bp-block-components', 42 plugins_url( 'js/block-components.js', __FILE__ ), 43 array( 44 'wp-element', 45 'wp-components', 46 'wp-i18n', 47 'wp-api-fetch', 48 'wp-url', 49 ), 50 bp_get_version(), 53 plugins_url( 'blocks/block-components/index.js', __FILE__ ), 54 $asset['dependencies'], 55 $asset['version'], 51 56 false 52 57 ); 53 54 // Adds BP Block Components to the `bp` global.55 wp_add_inline_script(56 'bp-block-components',57 'window.bp = window.bp || {};58 bp.blockComponents = bpBlock.blockComponents;59 delete bpBlock;',60 'after'61 );62 58 } 63 59 add_action( 'bp_blocks_init', 'bp_register_block_components', 1 ); … … 67 63 * 68 64 * @since 9.0.0 65 * @since 12.0.0 Adds the BuddyPress Blocks collection & uses the `@wordpress/scripts` 66 * `index.asset.php` generated file to get dependencies. 69 67 */ 70 68 function bp_register_block_assets() { 69 $default_asset = array( 70 'dependencies' => array(), 71 'version' => bp_get_version(), 72 ); 73 $asset_data_file = trailingslashit( dirname( __FILE__ ) ) . 'blocks/block-data/index.asset.php'; 74 75 if ( file_exists( $asset_data_file ) ) { 76 $asset_data = require $asset_data_file; 77 } else { 78 $asset_data = $default_asset; 79 } 80 71 81 wp_register_script( 72 82 'bp-block-data', 73 plugins_url( 'js/block-data.js', __FILE__ ), 74 array( 75 'wp-data', 76 'wp-api-fetch', 77 'lodash', 78 ), 79 bp_get_version(), 83 plugins_url( 'blocks/block-data/index.js', __FILE__ ), 84 $asset_data['dependencies'], 85 $asset_data['version'], 80 86 false 81 87 ); 82 88 83 // Adds BP Block Assets to the `bp` global. 84 wp_add_inline_script( 85 'bp-block-data', 86 sprintf( 87 'window.bp = window.bp || {}; 88 bp.blockData = bpBlock.blockData; 89 bp.blockData.embedScriptURL = \'%s\'; 90 delete bpBlock;', 91 esc_url_raw( includes_url( 'js/wp-embed.min.js' ) ) 92 ), 93 'after' 89 $asset_collection_file = trailingslashit( dirname( __FILE__ ) ) . 'blocks/block-collection/index.asset.php'; 90 91 if ( file_exists( $asset_collection_file ) ) { 92 $asset_collection = require $asset_collection_file; 93 } else { 94 $asset_collection = $default_asset; 95 } 96 97 wp_register_script( 98 'bp-blocks-collection', 99 plugins_url( 'blocks/block-collection/index.js', __FILE__ ), 100 $asset_collection['dependencies'], 101 $asset_collection['version'], 102 false 94 103 ); 95 104 } 96 105 add_action( 'bp_blocks_init', 'bp_register_block_assets', 2 ); 106 107 /** 108 * Enqueue additional BP Assets for the Block Editor. 109 * 110 * @since 12.0.0 111 */ 112 function bp_enqueue_block_editor_assets() { 113 wp_enqueue_script( 'bp-blocks-collection' ); 114 115 /** 116 * Fires when it's time to enqueue BP Block assets. 117 * 118 * @since 12.0.0 119 */ 120 do_action( 'bp_enqueue_block_editor_assets' ); 121 } 122 add_action( 'enqueue_block_editor_assets', 'bp_enqueue_block_editor_assets', 9 ); 97 123 98 124 /** -
trunk/src/bp-core/bp-core-cssjs.php
r13382 r13464 95 95 // Version 2.7. 96 96 'bp-livestamp' => array( 'file' => "{$url}vendor/livestamp{$min}.js", 'dependencies' => array( 'jquery', 'moment' ), 'footer' => true ), 97 98 // Version 9.0.99 'bp-dynamic-widget-block-script' => array( 'file' => "{$url}dynamic-widget-block.js", 'dependencies' => array( 'lodash', 'wp-url' ), 'footer' => true ),100 97 ); 101 98 … … 117 114 $scripts['bp-moment-locale'] = array( 'file' => esc_url( $moment_locale_url ), 'dependencies' => array( 'bp-moment' ), 'footer' => true ); 118 115 } 116 } 117 118 if ( bp_support_blocks() ) { 119 $asset = array( 120 'dependencies' => array(), 121 'version' => '' 122 ); 123 $asset_path = trailingslashit( dirname( __FILE__ ) ) . 'blocks/dynamic-widget-block/index.asset.php'; 124 125 if ( file_exists( $asset_path ) ) { 126 $asset = require $asset_path; 127 } 128 129 $scripts['bp-dynamic-widget-block'] = array( 130 'file' => plugins_url( 'blocks/dynamic-widget-block/index.js', __FILE__ ), 131 'dependencies' => $asset['dependencies'], 132 'footer' => true, 133 ); 119 134 } 120 135 -
trunk/src/bp-core/classes/class-bp-core.php
r13441 r13464 453 453 * 454 454 * @since 9.0.0 455 * @since 12.0.0 Use the WP Blocks API v2. 455 456 * 456 457 * @param array $blocks Optional. See BP_Component::blocks_init() for … … 461 462 array( 462 463 'bp/login-form' => array( 463 'name' => 'bp/login-form', 464 'editor_script' => 'bp-login-form-block', 465 'editor_script_url' => plugins_url( 'js/blocks/login-form.js', dirname( __FILE__ ) ), 466 'editor_script_deps' => array( 467 'wp-blocks', 468 'wp-element', 469 'wp-components', 470 'wp-i18n', 471 'wp-block-editor', 472 'wp-server-side-render', 473 ), 474 'style' => 'bp-login-form-block', 475 'style_url' => plugins_url( 'css/blocks/login-form.css', dirname( __FILE__ ) ), 476 'attributes' => array( 477 'title' => array( 478 'type' => 'string', 479 'default' => '', 480 ), 481 'forgotPwdLink' => array( 482 'type' => 'boolean', 483 'default' => false, 484 ), 485 ), 486 'render_callback' => 'bp_block_render_login_form_block', 464 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-core/blocks/login-form', 465 'render_callback' => 'bp_block_render_login_form_block', 487 466 ), 488 467 ) -
trunk/src/bp-friends/bp-friends-cssjs.php
r13092 r13464 15 15 * 16 16 * @since 9.0.0 17 * @since 12.0.0 Uses the `@wordpress/scripts` `index.asset.php` generated file to get dependencies. 17 18 * 18 19 * @param array $scripts Data about the scripts to register. … … 20 21 */ 21 22 function bp_friends_register_scripts( $scripts = array() ) { 23 if ( ! bp_support_blocks() ) { 24 return $scripts; 25 } 26 27 $asset = array( 28 'dependencies' => array(), 29 'version' => '' 30 ); 31 $asset_path = trailingslashit( dirname( __FILE__ ) ) . 'blocks/dynamic-widget/index.asset.php'; 32 33 if ( file_exists( $asset_path ) ) { 34 $asset = require $asset_path; 35 } 36 22 37 $scripts['bp-friends-script'] = array( 23 'file' => plugins_url( 'js/friends.js', __FILE__ ), 24 'dependencies' => array( 25 'bp-dynamic-widget-block-script', 26 'wp-i18n', 27 ), 38 'file' => plugins_url( 'blocks/dynamic-widget/index.js', __FILE__ ), 39 'dependencies' => $asset['dependencies'], 28 40 'footer' => true, 29 41 ); -
trunk/src/bp-friends/classes/class-bp-friends-component.php
r13450 r13464 371 371 * 372 372 * @since 9.0.0 373 * @since 12.0.0 Use the WP Blocks API v2. 373 374 * 374 375 * @param array $blocks Optional. See BP_Component::blocks_init() for … … 379 380 array( 380 381 'bp/friends' => array( 381 'name' => 'bp/friends', 382 'editor_script' => 'bp-friends-block', 383 'editor_script_url' => plugins_url( 'js/blocks/friends.js', dirname( __FILE__ ) ), 384 'editor_script_deps' => array( 385 'wp-blocks', 386 'wp-element', 387 'wp-components', 388 'wp-i18n', 389 'wp-block-editor', 390 'wp-server-side-render', 391 'bp-block-data', 392 ), 393 'style' => 'bp-friends-block', 394 'style_url' => plugins_url( 'css/blocks/friends.css', dirname( __FILE__ ) ), 395 'attributes' => array( 396 'maxFriends' => array( 397 'type' => 'number', 398 'default' => 5, 399 ), 400 'friendDefault' => array( 401 'type' => 'string', 402 'default' => 'active', 403 ), 404 'linkTitle' => array( 405 'type' => 'boolean', 406 'default' => false, 407 ), 408 'postId' => array( 409 'type' => 'number', 410 'default' => 0, 411 ), 412 ), 413 'render_callback' => 'bp_friends_render_friends_block', 382 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-friends/blocks/dynamic-friends', 383 'render_callback' => 'bp_friends_render_friends_block', 414 384 ), 415 385 ) -
trunk/src/bp-groups/bp-groups-cssjs.php
r13140 r13464 66 66 * 67 67 * @since 9.0.0 68 * @since 12.0.0 Uses the `@wordpress/scripts` `index.asset.php` generated file to get dependencies. 68 69 * 69 70 * @param array $scripts Data about the scripts to register. … … 71 72 */ 72 73 function bp_groups_register_widget_block_scripts( $scripts = array() ) { 74 if ( ! bp_support_blocks() ) { 75 return $scripts; 76 } 77 78 $asset = array( 79 'dependencies' => array(), 80 'version' => '' 81 ); 82 $asset_path = trailingslashit( dirname( __FILE__ ) ) . 'blocks/dynamic-widget/index.asset.php'; 83 84 if ( file_exists( $asset_path ) ) { 85 $asset = require $asset_path; 86 } 87 73 88 $scripts['bp-dynamic-groups-script'] = array( 74 'file' => plugins_url( 'js/dynamic-groups.js', __FILE__ ), 75 'dependencies' => array( 76 'bp-dynamic-widget-block-script', 77 'wp-i18n', 78 ), 89 'file' => plugins_url( 'blocks/dynamic-widget/index.js', __FILE__ ), 90 'dependencies' => $asset['dependencies'], 79 91 'footer' => true, 80 92 ); -
trunk/src/bp-groups/classes/class-bp-groups-component.php
r13456 r13464 1213 1213 * 1214 1214 * @since 6.0.0 1215 * @since 12.0.0 Use the WP Blocks API v2. 1215 1216 * 1216 1217 * @param array $blocks Optional. See BP_Component::blocks_init() for … … 1221 1222 array( 1222 1223 'bp/group' => array( 1223 'name' => 'bp/group', 1224 'editor_script' => 'bp-group-block', 1225 'editor_script_url' => plugins_url( 'js/blocks/group.js', dirname( __FILE__ ) ), 1226 'editor_script_deps' => array( 1227 'wp-blocks', 1228 'wp-element', 1229 'wp-components', 1230 'wp-i18n', 1231 'wp-block-editor', 1232 'wp-server-side-render', 1233 'bp-block-components', 1234 'bp-block-data', 1235 ), 1236 'style' => 'bp-group-block', 1237 'style_url' => plugins_url( 'css/blocks/group.css', dirname( __FILE__ ) ), 1238 'render_callback' => 'bp_groups_render_group_block', 1239 'attributes' => array( 1240 'itemID' => array( 1241 'type' => 'integer', 1242 'default' => 0, 1243 ), 1244 'avatarSize' => array( 1245 'type' => 'string', 1246 'default' => 'full', 1247 ), 1248 'displayDescription' => array( 1249 'type' => 'boolean', 1250 'default' => true, 1251 ), 1252 'displayActionButton' => array( 1253 'type' => 'boolean', 1254 'default' => true, 1255 ), 1256 'displayCoverImage' => array( 1257 'type' => 'boolean', 1258 'default' => true, 1259 ), 1260 ), 1224 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-groups/blocks/group', 1225 'render_callback' => 'bp_groups_render_group_block', 1261 1226 ), 1262 1227 'bp/groups' => array( 1263 'name' => 'bp/groups', 1264 'editor_script' => 'bp-groups-block', 1265 'editor_script_url' => plugins_url( 'js/blocks/groups.js', dirname( __FILE__ ) ), 1266 'editor_script_deps' => array( 1267 'wp-blocks', 1268 'wp-element', 1269 'wp-components', 1270 'wp-i18n', 1271 'wp-api-fetch', 1272 'wp-url', 1273 'wp-block-editor', 1274 'bp-block-components', 1275 'bp-block-data', 1276 'lodash', 1277 ), 1278 'style' => 'bp-groups-block', 1279 'style_url' => plugins_url( 'css/blocks/groups.css', dirname( __FILE__ ) ), 1280 'attributes' => array( 1281 'itemIDs' => array( 1282 'type' => 'array', 1283 'items' => array( 1284 'type' => 'integer', 1285 ), 1286 ), 1287 'avatarSize' => array( 1288 'type' => 'string', 1289 'default' => 'full', 1290 ), 1291 'displayGroupName' => array( 1292 'type' => 'boolean', 1293 'default' => true, 1294 ), 1295 'extraInfo' => array( 1296 'type' => 'string', 1297 'default' => 'none', 1298 'enum' => array( 'description', 'popular', 'active', 'none' ), 1299 ), 1300 'layoutPreference' => array( 1301 'type' => 'string', 1302 'default' => 'list', 1303 'enum' => array( 'list', 'grid' ), 1304 ), 1305 'columns' => array( 1306 'type' => 'number', 1307 'default' => 2, 1308 ), 1309 ), 1310 'render_callback' => 'bp_groups_render_groups_block', 1228 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-groups/blocks/groups', 1229 'render_callback' => 'bp_groups_render_groups_block', 1311 1230 ), 1312 1231 'bp/dynamic-groups' => array( 1313 'name' => 'bp/dynamic-groups', 1314 'editor_script' => 'bp-dynamic-groups-block', 1315 'editor_script_url' => plugins_url( 'js/blocks/dynamic-groups.js', dirname( __FILE__ ) ), 1316 'editor_script_deps' => array( 1317 'wp-blocks', 1318 'wp-element', 1319 'wp-components', 1320 'wp-i18n', 1321 'wp-block-editor', 1322 'wp-server-side-render', 1323 ), 1324 'style' => 'bp-dynamic-groups-block', 1325 'style_url' => plugins_url( 'css/blocks/dynamic-groups.css', dirname( __FILE__ ) ), 1326 'attributes' => array( 1327 'title' => array( 1328 'type' => 'string', 1329 'default' => __( 'Groups', 'buddypress' ), 1330 ), 1331 'maxGroups' => array( 1332 'type' => 'number', 1333 'default' => 5, 1334 ), 1335 'groupDefault' => array( 1336 'type' => 'string', 1337 'default' => 'active', 1338 ), 1339 'linkTitle' => array( 1340 'type' => 'boolean', 1341 'default' => false, 1342 ), 1343 ), 1344 'render_callback' => 'bp_groups_render_dynamic_groups_block', 1232 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-groups/blocks/dynamic-groups', 1233 'render_callback' => 'bp_groups_render_dynamic_groups_block', 1345 1234 ), 1346 1235 ) -
trunk/src/bp-members/bp-members-cssjs.php
r13105 r13464 15 15 * 16 16 * @since 9.0.0 17 * @since 12.0.0 Uses the `@wordpress/scripts` `index.asset.php` generated file to get dependencies. 17 18 * 18 19 * @param array $scripts Data about the scripts to register. … … 20 21 */ 21 22 function bp_members_register_scripts( $scripts = array() ) { 23 if ( ! bp_support_blocks() ) { 24 return $scripts; 25 } 26 27 $asset = array( 28 'dependencies' => array(), 29 'version' => '' 30 ); 31 $asset_path = trailingslashit( dirname( __FILE__ ) ) . 'blocks/dynamic-widget/index.asset.php'; 32 33 if ( file_exists( $asset_path ) ) { 34 $asset = require $asset_path; 35 } 36 22 37 $scripts['bp-dynamic-members-script'] = array( 38 'file' => plugins_url( 'blocks/dynamic-widget/index.js', __FILE__ ), 39 'dependencies' => $asset['dependencies'], 23 40 'footer' => true, 24 'file' => plugins_url( 'js/dynamic-members.js', __FILE__ ),25 'dependencies' => array(26 'bp-dynamic-widget-block-script',27 'wp-i18n',28 ),29 41 ); 30 42 -
trunk/src/bp-members/classes/class-bp-members-component.php
r13461 r13464 982 982 * 983 983 * @since 6.0.0 984 * @since 12.0.0 Use the WP Blocks API v2. 984 985 * 985 986 * @param array $blocks Optional. See BP_Component::blocks_init() for … … 990 991 array( 991 992 'bp/member' => array( 992 'name' => 'bp/member', 993 'editor_script' => 'bp-member-block', 994 'editor_script_url' => plugins_url( 'js/blocks/member.js', dirname( __FILE__ ) ), 995 'editor_script_deps' => array( 996 'wp-blocks', 997 'wp-element', 998 'wp-components', 999 'wp-i18n', 1000 'wp-block-editor', 1001 'wp-server-side-render', 1002 'bp-block-components', 1003 'bp-block-data', 1004 ), 1005 'style' => 'bp-member-block', 1006 'style_url' => plugins_url( 'css/blocks/member.css', dirname( __FILE__ ) ), 1007 'render_callback' => 'bp_members_render_member_block', 1008 'attributes' => array( 1009 'itemID' => array( 1010 'type' => 'integer', 1011 'default' => 0, 1012 ), 1013 'avatarSize' => array( 1014 'type' => 'string', 1015 'default' => 'full', 1016 ), 1017 'displayMentionSlug' => array( 1018 'type' => 'boolean', 1019 'default' => true, 1020 ), 1021 'displayActionButton' => array( 1022 'type' => 'boolean', 1023 'default' => true, 1024 ), 1025 'displayCoverImage' => array( 1026 'type' => 'boolean', 1027 'default' => true, 1028 ), 1029 ), 993 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-members/blocks/member', 994 'render_callback' => 'bp_members_render_member_block', 1030 995 ), 1031 996 'bp/members' => array( 1032 'name' => 'bp/members', 1033 'editor_script' => 'bp-members-block', 1034 'editor_script_url' => plugins_url( 'js/blocks/members.js', dirname( __FILE__ ) ), 1035 'editor_script_deps' => array( 1036 'wp-blocks', 1037 'wp-element', 1038 'wp-components', 1039 'wp-i18n', 1040 'wp-api-fetch', 1041 'wp-url', 1042 'wp-block-editor', 1043 'bp-block-components', 1044 'bp-block-data', 1045 'lodash', 1046 ), 1047 'style' => 'bp-members-block', 1048 'style_url' => plugins_url( 'css/blocks/members.css', dirname( __FILE__ ) ), 1049 'attributes' => array( 1050 'itemIDs' => array( 1051 'type' => 'array', 1052 'items' => array( 1053 'type' => 'integer', 1054 ), 1055 ), 1056 'avatarSize' => array( 1057 'type' => 'string', 1058 'default' => 'full', 1059 ), 1060 'displayMentionSlug' => array( 1061 'type' => 'boolean', 1062 'default' => true, 1063 ), 1064 'displayUserName' => array( 1065 'type' => 'boolean', 1066 'default' => true, 1067 ), 1068 'extraData' => array( 1069 'type' => 'string', 1070 'default' => 'none', 1071 'enum' => array( 'last_activity', 'latest_update', 'none' ), 1072 ), 1073 'layoutPreference' => array( 1074 'type' => 'string', 1075 'default' => 'list', 1076 'enum' => array( 'list', 'grid' ), 1077 ), 1078 'columns' => array( 1079 'type' => 'number', 1080 'default' => 2, 1081 ), 1082 ), 1083 'render_callback' => 'bp_members_render_members_block', 997 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-members/blocks/members', 998 'render_callback' => 'bp_members_render_members_block', 1084 999 ), 1085 1000 'bp/dynamic-members' => array( 1086 'name' => 'bp/dynamic-members', 1087 'editor_script' => 'bp-dynamic-members-block', 1088 'editor_script_url' => plugins_url( 'js/blocks/dynamic-members.js', dirname( __FILE__ ) ), 1089 'editor_script_deps' => array( 1090 'wp-blocks', 1091 'wp-element', 1092 'wp-components', 1093 'wp-i18n', 1094 'wp-block-editor', 1095 'wp-server-side-render', 1096 'bp-block-data', 1097 ), 1098 'style' => 'bp-dynamic-members-block', 1099 'style_url' => plugins_url( 'css/blocks/dynamic-members.css', dirname( __FILE__ ) ), 1100 'attributes' => array( 1101 'title' => array( 1102 'type' => 'string', 1103 'default' => __( 'Members', 'buddypress' ), 1104 ), 1105 'maxMembers' => array( 1106 'type' => 'number', 1107 'default' => 5, 1108 ), 1109 'memberDefault' => array( 1110 'type' => 'string', 1111 'default' => 'active', 1112 ), 1113 'linkTitle' => array( 1114 'type' => 'boolean', 1115 'default' => false, 1116 ), 1117 ), 1118 'render_callback' => 'bp_members_render_dynamic_members_block', 1001 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-members/blocks/dynamic-members', 1002 'render_callback' => 'bp_members_render_dynamic_members_block', 1119 1003 ), 1120 1004 'bp/online-members' => array( 1121 'name' => 'bp/online-members', 1122 'editor_script' => 'bp-online-members-block', 1123 'editor_script_url' => plugins_url( 'js/blocks/online-members.js', dirname( __FILE__ ) ), 1124 'editor_script_deps' => array( 1125 'wp-blocks', 1126 'wp-element', 1127 'wp-components', 1128 'wp-i18n', 1129 'wp-block-editor', 1130 'wp-server-side-render', 1131 ), 1132 'editor_style' => 'bp-member-avatar-blocks', 1133 'editor_style_url' => plugins_url( 'css/blocks/member-avatar-blocks.css', dirname( __FILE__ ) ), 1134 'attributes' => array( 1135 'title' => array( 1136 'type' => 'string', 1137 'default' => __( 'Who\'s Online', 'buddypress' ), 1138 ), 1139 'maxMembers' => array( 1140 'type' => 'number', 1141 'default' => 15, 1142 ), 1143 ), 1144 'render_callback' => 'bp_members_render_online_members_block', 1005 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-members/blocks/online-members', 1006 'render_callback' => 'bp_members_render_online_members_block', 1145 1007 ), 1146 1008 'bp/active-members' => array( 1147 'name' => 'bp/active-members', 1148 'editor_script' => 'bp-active-members-block', 1149 'editor_script_url' => plugins_url( 'js/blocks/active-members.js', dirname( __FILE__ ) ), 1150 'editor_script_deps' => array( 1151 'wp-blocks', 1152 'wp-element', 1153 'wp-components', 1154 'wp-i18n', 1155 'wp-block-editor', 1156 'wp-server-side-render', 1157 ), 1158 'editor_style' => 'bp-member-avatar-blocks', 1159 'editor_style_url' => plugins_url( 'css/blocks/member-avatar-blocks.css', dirname( __FILE__ ) ), 1160 'attributes' => array( 1161 'title' => array( 1162 'type' => 'string', 1163 'default' => __( 'Recently Active Members', 'buddypress' ), 1164 ), 1165 'maxMembers' => array( 1166 'type' => 'number', 1167 'default' => 15, 1168 ), 1169 ), 1170 'render_callback' => 'bp_members_render_active_members_block', 1009 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-members/blocks/active-members', 1010 'render_callback' => 'bp_members_render_active_members_block', 1171 1011 ), 1172 1012 ) -
trunk/src/bp-messages/bp-messages-blocks.php
r13096 r13464 38 38 39 39 // Don't display the block if there are no Notices to show. 40 $notice = \BP_Messages_Notice::get_active();40 $notice = BP_Messages_Notice::get_active(); 41 41 if ( empty( $notice->id ) ) { 42 42 // Previewing the Block inside the editor. -
trunk/src/bp-messages/bp-messages-cssjs.php
r13005 r13464 85 85 function bp_messages_register_scripts( $scripts = array() ) { 86 86 $scripts['bp-sitewide-notices-script'] = array( 87 'file' => plugins_url( ' js/sitewide-notices.js', __FILE__ ),87 'file' => plugins_url( 'blocks/close-notices-block/index.js', __FILE__ ), 88 88 'dependencies' => array(), 89 89 'footer' => true, -
trunk/src/bp-messages/classes/class-bp-messages-component.php
r13450 r13464 486 486 * 487 487 * @since 9.0.0 488 * @since 12.0.0 Use the WP Blocks API v2. 488 489 * 489 490 * @param array $blocks Optional. See BP_Component::blocks_init() for … … 494 495 array( 495 496 'bp/sitewide-notices' => array( 496 'name' => 'bp/sitewide-notices', 497 'editor_script' => 'bp-sitewide-notices-block', 498 'editor_script_url' => plugins_url( 'js/blocks/sitewide-notices.js', dirname( __FILE__ ) ), 499 'editor_script_deps' => array( 500 'wp-blocks', 501 'wp-element', 502 'wp-components', 503 'wp-i18n', 504 'wp-block-editor', 505 'wp-server-side-render', 506 'bp-block-data', 507 ), 508 'style' => 'bp-sitewide-notices-block', 509 'style_url' => plugins_url( 'css/blocks/sitewide-notices.css', dirname( __FILE__ ) ), 510 'attributes' => array( 511 'title' => array( 512 'type' => 'string', 513 'default' => '', 514 ), 515 ), 516 'render_callback' => 'bp_messages_render_sitewide_notices_block', 497 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-messages/blocks/sitewide-notices', 498 'render_callback' => 'bp_messages_render_sitewide_notices_block', 517 499 ), 518 500 ) -
trunk/src/bp-templates/bp-nouveau/includes/functions.php
r13364 r13464 1505 1505 * 1506 1506 * @since 9.0.0 1507 * @since 12.0.0 Use the WP Blocks API v2. 1507 1508 * 1508 1509 * @param array $blocks The Core Blocks list. … … 1510 1511 */ 1511 1512 function bp_nouveau_register_primary_nav_widget_block( $blocks = array() ) { 1512 $editor_style = bp_locate_template_asset( 'css/primary-nav.css' );1513 1514 1513 $blocks['bp/primary-nav'] = array( 1515 'name' => 'bp/primary-nav', 1516 'editor_script' => 'bp-primary-nav-block', 1517 'editor_script_url' => trailingslashit( buddypress()->plugin_url . 'bp-core' ) . 'js/blocks/primary-nav.js', 1518 'editor_script_deps' => array( 1519 'wp-blocks', 1520 'wp-element', 1521 'wp-components', 1522 'wp-i18n', 1523 'wp-block-editor', 1524 'wp-server-side-render', 1525 'bp-block-data', 1526 ), 1527 'editor_style' => 'bp-primary-nav-block', 1528 'editor_style_url' => $editor_style['uri'], 1529 'attributes' => array( 1530 'displayTitle' => array( 1531 'type' => 'boolean', 1532 'default' => true, 1533 ), 1534 ), 1535 'render_callback' => 'bp_nouveau_render_primary_nav_block', 1514 'metadata' => trailingslashit( buddypress()->plugin_dir ) . 'bp-core/blocks/primary-nav', 1515 'render_callback' => 'bp_nouveau_render_primary_nav_block', 1536 1516 ); 1537 1517 -
trunk/tests/phpunit/includes/testcase.php
r13442 r13464 196 196 $GLOBALS['bp']->{$component}->main_nav = array(); 197 197 $GLOBALS['bp']->{$component}->sub_nav = array(); 198 } 199 200 $block_registry = WP_Block_Type_Registry::get_instance(); 201 foreach ( array_keys( $block_registry->get_all_registered() ) as $block_name ) { 202 if ( 0 === strpos( $block_name, 'bp/' ) ) { 203 unregister_block_type( $block_name ); 204 } 198 205 } 199 206
Note: See TracChangeset
for help on using the changeset viewer.