Changeset 12998 for trunk/src/bp-core/classes/class-bp-component.php
- Timestamp:
- 07/14/2021 08:52:00 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-component.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-component.php
r12994 r12998 140 140 */ 141 141 public $search_query_arg = 's'; 142 143 /** 144 * An array of globalized data for BP Blocks. 145 * 146 * @since 9.0.0 147 * 148 * @var array 149 */ 150 public $block_globals = array(); 142 151 143 152 /** Methods ***************************************************************/ … … 206 215 * 207 216 * @since 1.5.0 208 * 217 * @since 9.0.0 Adds the `$block_globals` argument to the `$args` parameter. 209 218 * 210 219 * @param array $args { … … 222 231 * @type array $global_tables Optional. An array of database table names. 223 232 * @type array $meta_tables Optional. An array of metadata table names. 233 * @type array $block_globals Optional. An array of globalized data for BP Blocks. 224 234 * } 225 235 */ … … 242 252 'global_tables' => '', 243 253 'meta_tables' => '', 254 'block_globals' => array(), 244 255 ) ); 245 256 … … 306 317 if ( ! empty( $r['meta_tables'] ) ) { 307 318 $this->register_meta_tables( $r['meta_tables'] ); 319 } 320 321 /** 322 * Filters the $blocks global value. 323 * 324 * @since 9.0.0 325 * 326 * @param array $blocks a list of global properties for blocks keyed 327 * by their corresponding block name. 328 */ 329 $block_globals = apply_filters( 'bp_' . $this->id . '_block_globals', $r['block_globals'] ); 330 if ( is_array( $block_globals ) && array_filter( $block_globals ) ) { 331 foreach ( $block_globals as $block_name => $block_props ) { 332 $this->block_globals[ $block_name ] = new stdClass(); 333 334 // Initialize an `items` property for Widget Block occurrences. 335 $this->block_globals[ $block_name ]->items = array(); 336 337 // Set the global properties for the Block. 338 $this->block_globals[ $block_name ]->props = (array) $block_props; 339 } 308 340 } 309 341
Note: See TracChangeset
for help on using the changeset viewer.