Skip to content

Commit 83aed3f

Browse files
committed
Make hookup/rest an extended class of new CMB2_Hookup_Base. Also rework to handle rest saving/displaying via the post get/post endpoints.
1 parent 2e32e7f commit 83aed3f

File tree

5 files changed

+287
-194
lines changed

5 files changed

+287
-194
lines changed

bootstrap.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ function cmb2_bootstrap() {
5353
* @since 2.0.2
5454
*/
5555
foreach ( CMB2_Boxes::get_all() as $cmb ) {
56+
5657
if ( $cmb->prop( 'hookup' ) ) {
5758
$hookup = new CMB2_hookup( $cmb );
59+
$hookup->universal_hooks();
5860
}
61+
5962
if ( $cmb->prop( 'show_in_rest' ) ) {
60-
add_action( 'rest_api_init', array( new CMB2_REST( $cmb ), 'register_fields' ) );
63+
$rest = new CMB2_REST_Access( $cmb );
64+
$rest->universal_hooks();
6165
}
66+
6267
}
6368

6469
/**

includes/CMB2_Hookup_Base.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ abstract class CMB2_Hookup_Base {
2525
*/
2626
protected $object_type = 'post';
2727

28-
/**
29-
* Constructor
30-
* @since 2.0.0
31-
* @param CMB2 $cmb The CMB2 object to hookup
32-
*/
3328
public function __construct( CMB2 $cmb ) {
3429
$this->cmb = $cmb;
3530
$this->object_type = $this->cmb->mb_object_type();

includes/CMB2_REST.php

Lines changed: 0 additions & 188 deletions
This file was deleted.

0 commit comments

Comments
 (0)