mediawiki-extensions-Echo/includes/ooui/LabelIconWidget.php
WMDE-Fisch 713c28e861 Minor PHPdoc fixes
Change-Id: I037df8d0bd13dd7a8201fd1408bb2f642f9786b6
2017-10-13 13:48:05 +02:00

46 lines
1.1 KiB
PHP

<?php
namespace EchoOOUI;
use OOUI\IconElement;
use OOUI\LabelElement;
use OOUI\TitledElement;
use OOUI\Tag;
use OOUI\Widget;
use OOUI\HtmlSnippet;
/**
* Widget combining a label and icon
*/
class LabelIconWidget extends Widget {
use IconElement;
use LabelElement;
use TitledElement;
/**
* @param array $config Configuration options
* @param string|HtmlSnippet $config['label'] Label text
* @param string $config['title'] Title text
* @param string $config['icon'] Icon key
*/
public function __construct( $config ) {
parent::__construct( $config );
$this->tableRow = new Tag( 'div' );
$this->tableRow->setAttributes( [
'class' => 'oo-ui-labelIconWidget-row',
] );
$this->icon = new Tag( 'div' );
$this->label = new Tag( 'div' );
$this->initializeIconElement( array_merge( $config, [ 'iconElement' => $this->icon ] ) );
$this->initializeLabelElement( array_merge( $config, [ 'labelElement' => $this->label ] ) );
$this->initializeTitledElement( $config );
$this->addClasses( [ 'oo-ui-labelIconWidget' ] );
$this->tableRow->appendContent( $this->icon, $this->label );
$this->appendContent( $this->tableRow );
}
}