Skip to content

Commit

Permalink
Give our action some explicit variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg committed May 4, 2014
1 parent d2af20d commit 94bac7f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions helpers/cmb_Meta_Box_types.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,16 @@ public function __construct( $field ) {
* @param array $arguments All arguments passed to the method
*/
public function __call( $name, $arguments ) {

// Give our action some explicit variables
$field_type = $this;
$field_args = $field_type->field->args();
$escaped_value = $field_type->field->escaped_value();
$object_id = $field_type->field->object_id;
$object_type = $field_type->field->object_type;

// When a non-registered field is called, send it through an action.
do_action( "cmb_render_$name", $this->field->args(), $this->field->escaped_value(), $this->field->object_id, $this->field->object_type, $this );
do_action( "cmb_render_$name", $field_args, $escaped_value, $object_id, $object_type, $this );
}

/**
Expand Down Expand Up @@ -138,8 +146,9 @@ public function parse_args( $args, $element, $defaults ) {
public function concat_attrs( $attrs, $attr_exclude = array() ) {
$attributes = '';
foreach ( $attrs as $attr => $val ) {
if ( ! in_array( $attr, (array) $attr_exclude, true ) )
if ( ! in_array( $attr, (array) $attr_exclude, true ) ) {
$attributes .= sprintf( ' %s="%s"', $attr, $val );
}
}
return $attributes;
}
Expand Down

0 comments on commit 94bac7f

Please sign in to comment.