Changeset 12463 for trunk/src/bp-core/classes/class-bp-component.php
- Timestamp:
- 09/25/2019 11:22:00 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-component.php
r12451 r12463 868 868 * 869 869 * @since 5.0.0 870 */ 871 public function rest_api_init() { 870 * 871 * @param array $controllers The list of BP REST controllers to load. 872 */ 873 public function rest_api_init( $controllers = array() ) { 874 if ( is_array( $controllers ) && $controllers ) { 875 // Built-in controllers. 876 $_controllers = $controllers; 877 878 /** 879 * Use this filter to disable all or some REST API controllers 880 * for the component. 881 * 882 * This is a dynamic hook that is based on the component string ID. 883 * 884 * @since 5.0.0 885 * 886 * @param array $controllers The list of BP REST API controllers to load. 887 */ 888 $controllers = (array) apply_filters( 'bp_' . $this->id . '_rest_api_controllers', $controllers ); 889 890 foreach( $controllers as $controller ) { 891 if ( ! in_array( $controller, $_controllers, true ) ) { 892 continue; 893 } 894 895 $component_controller = new $controller; 896 $component_controller->register_routes(); 897 } 898 } 872 899 873 900 /**
Note: See TracChangeset
for help on using the changeset viewer.