X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiHelp.php;h=041b02479be984f7db793c55e3d016695f50a4e4;hp=529b32cda4da6f5cf72ec85ec2ebc8906a62333d;hb=56d45558b102349f3480a46819669407aa3be2d6;hpb=6f680554ceb988f3895184167d5006d722a0afb3 diff --git a/includes/api/ApiHelp.php b/includes/api/ApiHelp.php index 529b32cda4..041b02479b 100644 --- a/includes/api/ApiHelp.php +++ b/includes/api/ApiHelp.php @@ -1,9 +1,5 @@ addModules( 'mediawiki.toc' ); + $out->addModuleStyles( 'mediawiki.toc.styles' ); } $out->setPageTitle( $context->msg( 'api-help-title' ) ); @@ -153,7 +150,7 @@ class ApiHelp extends ApiBase { } $out->addHTML( $html ); - $helptitle = isset( $options['helptitle'] ) ? $options['helptitle'] : null; + $helptitle = $options['helptitle'] ?? null; $html = self::fixHelpLinks( $out->getHTML(), $helptitle, $haveModules ); $out->clearHTML(); $out->addHTML( $html ); @@ -470,11 +467,23 @@ class ApiHelp extends ApiBase { } } + // Templated? + if ( !empty( $settings[ApiBase::PARAM_TEMPLATE_VARS] ) ) { + $vars = []; + $msg = 'api-help-param-templated-var-first'; + foreach ( $settings[ApiBase::PARAM_TEMPLATE_VARS] as $k => $v ) { + $vars[] = $context->msg( $msg, $k, $module->encodeParamName( $v ) ); + $msg = 'api-help-param-templated-var'; + } + $info[] = $context->msg( 'api-help-param-templated' ) + ->numParams( count( $vars ) ) + ->params( Message::listParam( $vars ) ) + ->parse(); + } + // Type documentation if ( !isset( $settings[ApiBase::PARAM_TYPE] ) ) { - $dflt = isset( $settings[ApiBase::PARAM_DFLT] ) - ? $settings[ApiBase::PARAM_DFLT] - : null; + $dflt = $settings[ApiBase::PARAM_DFLT] ?? null; if ( is_bool( $dflt ) ) { $settings[ApiBase::PARAM_TYPE] = 'boolean'; } elseif ( is_string( $dflt ) || is_null( $dflt ) ) { @@ -493,12 +502,8 @@ class ApiHelp extends ApiBase { if ( is_array( $type ) ) { $count = count( $type ); - $deprecatedValues = isset( $settings[ApiBase::PARAM_DEPRECATED_VALUES] ) - ? $settings[ApiBase::PARAM_DEPRECATED_VALUES] - : []; - $links = isset( $settings[ApiBase::PARAM_VALUE_LINKS] ) - ? $settings[ApiBase::PARAM_VALUE_LINKS] - : []; + $deprecatedValues = $settings[ApiBase::PARAM_DEPRECATED_VALUES] ?? []; + $links = $settings[ApiBase::PARAM_VALUE_LINKS] ?? []; $values = array_map( function ( $v ) use ( $links, $deprecatedValues ) { $attr = []; if ( $v !== '' ) { @@ -697,9 +702,7 @@ class ApiHelp extends ApiBase { $info[] = implode( ' ', $extra ); } - $allowAll = isset( $settings[ApiBase::PARAM_ALL] ) - ? $settings[ApiBase::PARAM_ALL] - : false; + $allowAll = $settings[ApiBase::PARAM_ALL] ?? false; if ( $allowAll || $settings[ApiBase::PARAM_TYPE] === 'namespace' ) { if ( $settings[ApiBase::PARAM_TYPE] === 'namespace' ) { $allSpecifier = ApiBase::ALL_DEFAULT_STRING; @@ -723,9 +726,7 @@ class ApiHelp extends ApiBase { } // Add default - $default = isset( $settings[ApiBase::PARAM_DFLT] ) - ? $settings[ApiBase::PARAM_DFLT] - : null; + $default = $settings[ApiBase::PARAM_DFLT] ?? null; if ( $default === '' ) { $info[] = $context->msg( 'api-help-param-default-empty' ) ->parse();