BP_Group_Extension::parse_legacy_properties()
Parse legacy properties.
Description
The old standard for BP_Group_Extension was for plugins to register their settings as properties in their constructor. The new method is to pass a config array to the init() method. In order to support legacy plugins, we slurp up legacy properties, and later on we’ll parse them into the new init() array.
Source
File: bp-groups/classes/class-bp-group-extension.php
1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 | protected function parse_legacy_properties() { // Only run this one time. if ( ! empty ( $this ->legacy_properties_converted ) ) { return ; } $properties = $this ->get_legacy_property_list(); // By-reference variable for convenience. $lpc =& $this ->legacy_properties_converted; foreach ( $properties as $property ) { // No legacy config exists for this key. if ( ! isset( $this ->{ $property } ) ) { continue ; } // Grab the value and record it as appropriate. $value = $this ->{ $property }; switch ( $property ) { case 'enable_create_step' : $lpc [ 'screens' ][ 'create' ][ 'enabled' ] = (bool) $value ; break ; case 'enable_edit_item' : $lpc [ 'screens' ][ 'edit' ][ 'enabled' ] = (bool) $value ; break ; case 'enable_admin_item' : $lpc [ 'screens' ][ 'admin' ][ 'enabled' ] = (bool) $value ; break ; case 'create_step_position' : $lpc [ 'screens' ][ 'create' ][ 'position' ] = $value ; break ; // Note: 'admin' becomes 'edit' to distinguish from Dashboard 'admin'. case 'admin_name' : $lpc [ 'screens' ][ 'edit' ][ 'name' ] = $value ; break ; case 'admin_slug' : $lpc [ 'screens' ][ 'edit' ][ 'slug' ] = $value ; break ; case 'create_name' : $lpc [ 'screens' ][ 'create' ][ 'name' ] = $value ; break ; case 'create_slug' : $lpc [ 'screens' ][ 'create' ][ 'slug' ] = $value ; break ; case 'admin_metabox_context' : $lpc [ 'screens' ][ 'admin' ][ 'metabox_context' ] = $value ; break ; case 'admin_metabox_priority' : $lpc [ 'screens' ][ 'admin' ][ 'metabox_priority' ] = $value ; break ; default : $lpc [ $property ] = $value ; break ; } } } |
Changelog
Version | Description |
---|---|
BuddyPress 1.8.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.