Module:Message box: Difference between revisions

    m>Mr. Stradivarius
    (add a template link when generating the subst error message)
    m>Mr. Stradivarius
    (make invalid type errors depend on cfg.showInvalidTypeError)
    Line 170: Line 170:
         self.type = args.type
         self.type = args.type
         local typeData = cfg.types[self.type]
         local typeData = cfg.types[self.type]
         self.invalidType = self.type and not typeData and true or false
         self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false
         typeData = typeData or cfg.types[cfg.default]
         typeData = typeData or cfg.types[cfg.default]
         self.typeClass = typeData.class
         self.typeClass = typeData.class
    Line 384: Line 384:


         -- Categories for all namespaces.
         -- Categories for all namespaces.
         if self.invalidType then
         if self.invalidTypeError then
             local allSort = (nsid == 0 and 'Main:' or '') .. self.title.prefixedText
             local allSort = (nsid == 0 and 'Main:' or '') .. self.title.prefixedText
             self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
             self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort)
    Line 504: Line 504:


         -- Add error message for invalid type parameters.
         -- Add error message for invalid type parameters.
         if self.invalidType then
         if self.invalidTypeError then
             root
             root
                 .tag('div')
                 .tag('div')