Skip to content

Commit

Permalink
CMB2/CMB2_Base::do_callback() now accepts a $additional_params second…
Browse files Browse the repository at this point in the history
… param
  • Loading branch information
jtsternberg committed Nov 14, 2017
1 parent 498fa8d commit 131e9ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions includes/CMB2.php
Original file line number Diff line number Diff line change
Expand Up @@ -1649,11 +1649,12 @@ public function search_old_school_array( $field_id, $fields ) {
* Handles metabox property callbacks, and passes this $cmb object as property.
*
* @since 2.2.3
* @param callable $cb The callback method/function/closure.
* @return mixed Return of the callback function.
* @param callable $cb The callback method/function/closure
* @param mixed $additional_params Any additoinal parameters which should be passed to the callback.
* @return mixed Return of the callback function.
*/
protected function do_callback( $cb ) {
return call_user_func( $cb, $this );
public function do_callback( $cb, $additional_params = null ) {
return call_user_func( $cb, $this, $additional_params );
}

/**
Expand Down
9 changes: 5 additions & 4 deletions includes/CMB2_Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,12 @@ public function unset_param_callback_cache( $param ) {
* Handles the parameter callbacks, and passes this object as parameter.
*
* @since 2.2.3
* @param callable $cb The callback method/function/closure
* @return mixed Return of the callback function.
* @param callable $cb The callback method/function/closure
* @param mixed $additional_params Any additoinal parameters which should be passed to the callback.
* @return mixed Return of the callback function.
*/
protected function do_callback( $cb ) {
return call_user_func( $cb, $this->{$this->properties_name}, $this );
protected function do_callback( $cb, $additional_params = null ) {
return call_user_func( $cb, $this->{$this->properties_name}, $this, $additional_params );
}

/**
Expand Down

0 comments on commit 131e9ac

Please sign in to comment.