*
* Created on Aug 29, 2014
*
- * Copyright © 2014 Brad Jorsch <bjorsch@wikimedia.org>
+ * Copyright © 2014 Wikimedia Foundation and contributors
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
switch ( $type ) {
case 'submodule':
$groups[] = $name;
+
if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
$map = $settings[ApiBase::PARAM_SUBMODULE_MAP];
- ksort( $map );
- $submodules = [];
- foreach ( $map as $v => $m ) {
- $submodules[] = "[[Special:ApiHelp/{$m}|{$v}]]";
- }
+ $defaultAttrs = [];
} else {
- $submodules = $module->getModuleManager()->getNames( $name );
- sort( $submodules );
- $prefix = $module->isMain()
- ? '' : ( $module->getModulePath() . '+' );
- $submodules = array_map( function ( $name ) use ( $prefix ) {
- $text = Html::element( 'span', [ 'dir' => 'ltr', 'lang' => 'en' ], $name );
- return "[[Special:ApiHelp/{$prefix}{$name}|{$text}]]";
- }, $submodules );
+ $prefix = $module->isMain() ? '' : ( $module->getModulePath() . '+' );
+ $map = [];
+ foreach ( $module->getModuleManager()->getNames( $name ) as $submoduleName ) {
+ $map[$submoduleName] = $prefix . $submoduleName;
+ }
+ $defaultAttrs = [ 'dir' => 'ltr', 'lang' => 'en' ];
+ }
+ ksort( $map );
+
+ $submodules = [];
+ $deprecatedSubmodules = [];
+ foreach ( $map as $v => $m ) {
+ $attrs = $defaultAttrs;
+ $arr = &$submodules;
+ try {
+ $submod = $module->getModuleFromPath( $m );
+ if ( $submod ) {
+ if ( $submod->isDeprecated() ) {
+ $arr = &$deprecatedSubmodules;
+ $attrs['class'] = 'apihelp-deprecated-value';
+ }
+ }
+ } catch ( ApiUsageException $ex ) {
+ // Ignore
+ }
+ if ( $attrs ) {
+ $v = Html::element( 'span', $attrs, $v );
+ }
+ $arr[] = "[[Special:ApiHelp/{$m}|{$v}]]";
}
+ $submodules = array_merge( $submodules, $deprecatedSubmodules );
$count = count( $submodules );
$info[] = $context->msg( 'api-help-param-list' )
->params( $multi ? 2 : 1 )