Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a filter to allow for adding arbitrary HTML attributes to a group… #582

Merged
merged 1 commit into from
Aug 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion includes/CMB2.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,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 ', $field_group->row_classes(), '" data-fieldtype="group"><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 ', $field_group->row_classes(), '" data-fieldtype="group"><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