Page MenuHomeWickedGov Phorge

UIUtils.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

UIUtils.php

<?php
namespace MediaWiki\Extension\OAuth\Frontend;
use MediaWiki\Context\IContextSource;
use MediaWiki\Message\Message;
use OOUI\Tag;
/**
* Static utility class for the special pages
*/
class UIUtils {
/**
* Generate an information table for a consumer. The result will be suitable for use as a
* HTMLForm field with no label.
* @param array $info fieldname-message => description; description will be escaped (use
* HtmlSnippet to avoid); fields with null value will be ignored; messages will be interpreted
* as plaintext
* @param IContextSource $context
* @return string
*/
public static function generateInfoTable( $info, $context ) {
$dl = new Tag( 'dl' );
$dl->addClasses( [ 'mw-mwoauth-infotable' ] );
foreach ( $info as $fieldname => $description ) {
if ( $description === null ) {
continue;
} elseif ( $description instanceof Message ) {
$description = $description->plain();
}
$dt = new Tag( 'dt' );
$dd = new Tag( 'dd' );
$dt->appendContent( $context->msg( $fieldname )->text() );
$dd->appendContent( $description );
$dl->appendContent( $dt, $dd );
}
return $dl->toString();
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Jul 3, 18:37 (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
66/e5/b990c521d5d80d9b1dc5b395e08d
Default Alt Text
UIUtils.php (1 KB)

Event Timeline