/** * Generates de ButtonGroup object. * * @param Array $options the display options for the ButtonGroup. * @param Callable $block Block to generate inside ButtonGroup content. * @return ContentTag a ContentTag instance that represents the Button Group. */ private function build_button_group(array $options, $block) { $is_a_justified_button_group = $this->is_a_justified_button_group($options); $button_group_type = $this->get_button_group_type($options); $this->append_class($options, $button_group_type); $size_class = $this->get_button_group_size($options); $this->append_class($options, $size_class); if ($is_a_justified_button_group) { $this->append_class($options, 'btn-group-justified'); } $bg = new ContentTag('div', array_merge($options, ['aria-label' => 'button-group', 'role' => 'group']), function () use($block, $is_a_justified_button_group) { Base::set_justified_button_group($is_a_justified_button_group); $buttons = call_user_func($block); Base::set_justified_button_group(false); return $buttons; }); return $bg; }