Merge "API: Add a "submodule" param type"
[lhc/web/wiklou.git] / includes / api / ApiBase.php
index c05a833..23a3867 100644 (file)
@@ -435,6 +435,10 @@ abstract class ApiBase extends ContextSource {
                                                $prompt = 'One value: ';
                                        }
 
+                                       if ( $type === 'submodule' ) {
+                                               $type = $this->getModuleManager()->getNames( $paramName );
+                                               sort( $type );
+                                       }
                                        if ( is_array( $type ) ) {
                                                $choices = array();
                                                $nothingPrompt = '';
@@ -998,6 +1002,9 @@ abstract class ApiBase extends ContextSource {
                        if ( isset( $value ) && $type == 'namespace' ) {
                                $type = MWNamespace::getValidNamespaces();
                        }
+                       if ( isset( $value ) && $type == 'submodule' ) {
+                               $type = $this->getModuleManager()->getNames( $paramName );
+                       }
                }
 
                if ( isset( $value ) && ( $multi || is_array( $type ) ) ) {