Skip to content

Commit

Permalink
Add a filter to allow for adding arbitrary HTML attributes to a group…
Browse files Browse the repository at this point in the history
… wrapper element.
  • Loading branch information
jrfnl committed Feb 29, 2016
1 parent 895fc27 commit 8b03f8a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion includes/CMB2.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,24 @@ public function render_group( $args ) {
$remove_disabled = $nrows <= 1 ? 'disabled="disabled" ' : '';
$field_group->index = 0;

/**
* Allow for adding additional HTML attributes to a group wrapper.
*
* If you use this filter, make sure the resulting string always starts with a space!
*
* @since 2.2.2
*
* @param string Current attributes string.
*
* @param array $group_args All group arguments.
*
* @param string $id The group_id of the current group.
*/
$more_attributes = apply_filters( "cmb2_additional_group_attributes", '', $field_group->args, $args['id'] );

$field_group->peform_param_callback( 'before_group' );

echo '<div class="cmb-row cmb-repeat-group-wrap"><div class="cmb-td"><div id="', $field_group->id(), '_repeat" class="cmb-nested cmb-field-list cmb-repeatable-group', $sortable, $repeat_class, '" style="width:100%;">';
echo '<div class="cmb-row cmb-repeat-group-wrap"><div class="cmb-td"><div id="', $field_group->id(), '_repeat" class="cmb-nested cmb-field-list cmb-repeatable-group', $sortable, $repeat_class, '" style="width:100%;"', $more_attributes, '>';

if ( $desc || $label ) {
$class = $desc ? ' cmb-group-description' : '';
Expand Down

0 comments on commit 8b03f8a

Please sign in to comment.