mediawiki-extensions-Echo/includes/ooui/LabelIconWidget.php
Matthew Flaschen 188e8d7395 No-JS special page: One-click mark as read
Bug: T136361
Change-Id: I7896dbdf25d2c1624f97777f4c8d0af41b195ef0
Depends-On: Ic31f857c749d62a32cafae68dc3f1cbd86e1e382
2016-05-27 17:23:29 -07:00

45 lines
1.1 KiB
PHP

<?php
namespace EchoOOUI;
use OOUI\IconElement;
use OOUI\LabelElement;
use OOUI\TitledElement;
use OOUI\Tag;
use OOUI\Widget;
/**
* 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( array(
'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 );
}
}