1<?php
2
3namespace OOUI;
4
5/**
6 * Group widget for multiple related buttons.
7 *
8 * Use together with ButtonWidget.
9 */
10class ButtonGroupWidget extends Widget {
11	use GroupElement;
12	use TitledElement;
13
14	/* Static Properties */
15
16	public static $tagName = 'span';
17
18	/**
19	 * @param array $config Configuration options
20	 *      - ButtonWidget[] $config['items'] Buttons to add
21	 */
22	public function __construct( array $config = [] ) {
23		// Parent constructor
24		parent::__construct( $config );
25
26		// Traits
27		$this->initializeGroupElement( array_merge( [ 'group' => $this ], $config ) );
28		$this->initializeTitledElement( $config );
29
30		// Initialization
31		$this->addClasses( [ 'oo-ui-buttonGroupWidget' ] );
32		if ( isset( $config['items'] ) ) {
33			$this->addItems( $config['items'] );
34		}
35	}
36}
37