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