Go to the documentation of this file.
32 parent::__construct( $descriptor,
$context, $messagePrefix );
34 $this->
getOutput()->addModuleStyles(
'mediawiki.htmlform.ooui.styles' );
46 $field = parent::loadInputFromParameters( $fieldname, $descriptor,
$parent );
47 $field->setShowEmptyLabel(
false );
55 $isBadIE = preg_match(
'/MSIE [1-7]\./i', $this->
getRequest()->getHeader(
'User-Agent' ) );
57 if ( $this->mShowSubmit ) {
60 if ( isset( $this->mSubmitID ) ) {
64 if ( isset( $this->mSubmitName ) ) {
68 if ( isset( $this->mSubmitTooltip ) ) {
75 $attribs[
'classes'] = [
'mw-htmlform-submit' ];
82 $buttons .=
new OOUI\ButtonInputWidget(
$attribs );
85 if ( $this->mShowReset ) {
86 $buttons .=
new OOUI\ButtonInputWidget( [
88 'label' => $this->
msg(
'htmlform-reset' )->
text(),
89 'useInputTag' => $isBadIE,
93 if ( $this->mShowCancel ) {
95 if ( $target instanceof
Title ) {
96 $target = $target->getLocalURL();
98 $buttons .=
new OOUI\ButtonWidget( [
99 'label' => $this->
msg(
'cancel' )->
text(),
104 foreach ( $this->mButtons
as $button ) {
107 if ( $button[
'attribs'] ) {
108 $attrs += $button[
'attribs'];
111 if ( isset( $button[
'id'] ) ) {
112 $attrs[
'id'] = $button[
'id'];
116 $label = $button[
'value'];
117 } elseif ( isset( $button[
'label-message'] ) ) {
118 $label =
new OOUI\HtmlSnippet( $this->
getMessage( $button[
'label-message'] )->parse() );
119 } elseif ( isset( $button[
'label'] ) ) {
120 $label = $button[
'label'];
121 } elseif ( isset( $button[
'label-raw'] ) ) {
122 $label =
new OOUI\HtmlSnippet( $button[
'label-raw'] );
124 $label = $button[
'value'];
127 $attrs[
'classes'] = isset( $attrs[
'class'] ) ? (
array)$attrs[
'class'] : [];
129 $buttons .=
new OOUI\ButtonInputWidget( [
131 'name' => $button[
'name'],
132 'value' => $button[
'value'],
134 'flags' => $button[
'flags'],
135 'framed' => $button[
'framed'],
136 'useInputTag' => $isBadIE,
145 [
'class' =>
'mw-htmlform-submit-buttons' ],
"\n$buttons" ) .
"\n";
150 $layout =
new OOUI\PanelLayout( [
154 'infusable' =>
false,
157 $layout->appendContent(
158 new OOUI\FieldsetLayout( [
160 'infusable' =>
false,
163 'content' =>
new OOUI\HtmlSnippet(
$section )
179 if ( !$fieldsHtml ) {
185 $html = implode(
'', $fieldsHtml );
187 if ( $sectionName ) {
190 [
'id' => Sanitizer::escapeIdForAttribute( $sectionName ) ],
203 if ( $elements ===
'' ) {
207 if ( !in_array( $elementsType, [
'error',
'warning' ],
true ) ) {
208 throw new DomainException( $elementsType .
' is not a valid type.' );
211 if ( $elements instanceof
Status ) {
212 if ( !$elements->isGood() ) {
213 $errors = $elements->getErrorsByType( $elementsType );
214 foreach ( $errors
as &$error ) {
217 $error = array_merge( [ $error[
'message'] ], $error[
'params'] );
220 } elseif ( $elementsType ===
'error' ) {
221 if ( is_array( $elements ) ) {
223 } elseif ( is_string( $elements ) ) {
224 $errors = [ $elements ];
228 foreach ( $errors
as &$error ) {
229 $error = $this->
getMessage( $error )->parse();
230 $error =
new OOUI\HtmlSnippet( $error );
234 if ( $elementsType ===
'error' ) {
235 $this->oouiErrors = $errors;
237 $this->oouiWarnings = $errors;
247 return parent::getHeaderText(
$section );
252 $html = parent::getBody();
253 if ( $this->mHeader || $this->oouiErrors || $this->oouiWarnings ) {
254 $classes = [
'mw-htmlform-ooui-header' ];
255 if ( $this->oouiErrors ) {
256 $classes[] =
'mw-htmlform-ooui-header-errors';
258 if ( $this->oouiWarnings ) {
259 $classes[] =
'mw-htmlform-ooui-header-warnings';
262 if ( $this->mHeader ) {
263 $element =
new OOUI\LabelWidget( [
'label' =>
new OOUI\HtmlSnippet( $this->mHeader ) ] );
265 $element =
new OOUI\Widget( [] );
267 $html =
new OOUI\FieldLayout(
271 'errors' => $this->oouiErrors,
272 'notices' => $this->oouiWarnings,
273 'classes' => $classes,
281 if ( is_string( $this->mWrapperLegend ) ) {
282 $content =
new OOUI\FieldsetLayout( [
283 'label' => $this->mWrapperLegend,
286 'content' =>
new OOUI\HtmlSnippet(
$html )
295 'classes' => [
'mw-htmlform',
'mw-htmlform-ooui' ],
300 $form =
new OOUI\PanelLayout( [
301 'classes' => [
'mw-htmlform-ooui-wrapper' ],
303 'padded' => $this->mWrapperLegend !==
false,
304 'framed' => $this->mWrapperLegend !==
false,
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
static newMainPage()
Create a new Title for the Main Page.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Generic operation result class Has warning/error list, boolean status and arbitrary value.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
static titleAttrib( $name, $options=null, array $msgParams=[])
Given the id of an interface element, constructs the appropriate title attribute from the system mess...
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
Represents a title within MediaWiki.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
static accesskey( $name)
Given the id of an interface element, constructs the appropriate accesskey attribute from the system ...