Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.

« Module:Infobox/Configs/Plugin » : différence entre les versions

De Nefald
Hiob (discussion | contributions)
init
 
Hiob (discussion | contributions)
correction type
Ligne 4 : Ligne 4 :
     end,
     end,
      
      
    -- Icône avec type et nom pour les plugins
     icone = {
     icone = {
         type = 'fas',
         type = 'fas',
Ligne 21 : Ligne 20 :
     end,
     end,


     -- Configuration du champ "type" avec validation et catégorisation
     -- Configuration du champ "type" (utilisée par le Core)
     typeField = {
     typeField = {
         required = true, -- Le type est obligatoire pour les plugins
         required = true,
         allowedValues = {
         allowedValues = {
             ['économie'] = {
             ['économie'] = {
Ligne 30 : Ligne 29 :
             },
             },
             ['pvp'] = {
             ['pvp'] = {
                 display = 'PvP',
                 display = 'PvP',  
                 category = 'Plugins de PvP'
                 category = 'Plugins de PvP'
             },
             },
Ligne 80 : Ligne 79 :
                 display = 'Mob',
                 display = 'Mob',
                 category = 'Plugins de mobs'
                 category = 'Plugins de mobs'
            },
            ['craft'] = {
                display = 'Craft',
                category = 'Plugins de craft'
            }
        },
        errorMessage = 'Type de plugin non reconnu. Types autorisés : économie, pvp, roleplay, administration, protection, cosmétique, communication, utilitaire, mini-jeu, monde, inventaire, transport, magie, mob, craft'
    },
    -- Configuration du champ "status" avec validation et catégorisation
    statusField = {
        required = true, -- Le status est obligatoire
        allowedValues = {
            ['installé'] = {
                display = 'Installé',
                category = 'Plugin installé'
            },
            ['désinstallé'] = {
                display = 'Désinstallé',
                category = 'Plugin désinstallé'
            },
            ['en test'] = {
                display = 'En test',
                category = 'Plugin en test'
            },
            ['obsolète'] = {
                display = 'Obsolète',
                category = 'Plugin obsolète'
            },
            ['prévu'] = {
                display = 'Prévu',
                category = 'Plugin prévu'
            },
            ['abandonné'] = {
                display = 'Abandonné',
                category = 'Plugin abandonné'
             }
             }
         },
         },
         errorMessage = 'Status de plugin non reconnu. Status autorisés : installé, désinstallé, en test, obsolète, prévu, abandonné'
         errorMessage = 'Type de plugin non reconnu. Types autorisés : économie, pvp, roleplay, administration, protection, cosmétique, communication, utilitaire, mini-jeu, monde, inventaire, transport, magie, mob'
     },
     },


     sections = {
     sections = {
         {
         {
            titre = 'Plugin',
             champs = {
             champs = {
                 { cle = 'type', label = 'Type', required = true },
                 { cle = 'type', label = 'Type' },
                 { cle = 'dev', label = 'Développeur(s)' },
                 { cle = 'dev', label = 'Développeur' },
                { cle = 'bukkit', label = 'Bukkit', format = 'bukkit_link' },
                 { cle = 'status', label = 'Statut' },
                { cle = 'hangar', label = 'Hangar', format = 'hangar_link' },
                 { cle = 'grade', label = 'Grade requis' }
                { cle = 'modrinth', label = 'Modrinth', format = 'modrinth_link' },
                { cle = 'builtbybit', label = 'Builtbybit', format = 'builtbybit_link' },
                { cle = 'spigot', label = 'Spigot', format = 'spigot_link' },
                { cle = 'dépendance', label = 'Dépendance' },
                 { cle = 'compatibilité', label = 'Compatibilité' },
                 { cle = 'sources', label = 'Sources' }
             }
             }
         },
         },
         {
         {
             titre = 'Nefald',
             titre = 'Téléchargements',
             champs = {
             champs = {
                 { cle = 'status', label = 'Status', required = true },
                 { cle = 'bukkit', label = 'Bukkit' },
                 { cle = 'grade', label = 'Grade requis', format = 'grade_link' }
                { cle = 'hangar', label = 'Hangar (PaperMC)' },
                { cle = 'modrinth', label = 'Modrinth' },
                { cle = 'builtbybit', label = 'BuiltByBit' },
                 { cle = 'spigot', label = 'Spigot' },
                { cle = 'sources', label = 'Code source' }
             }
             }
         },
         },
         {
         {
             titre = 'Article',
             titre = 'Compatibilité',
             champs = {
             champs = {
                 { cle = 'derniere_revision', label = 'Dernière révision', auto = 'revision_date' }
                 { cle = 'dépendance', label = 'Dépendances' },
                { cle = 'compatibilité', label = 'Compatible avec' }
             }
             }
         }
         }
    },
    -- Formatters spéciaux pour les liens
    formatters = {
        bukkit_link = function(value)
            return '[https://dev.bukkit.org/projects/' .. value .. '/ ' .. value .. ']'
        end,
        hangar_link = function(value)
            return '[https://hangar.papermc.io/' .. value .. '/ ' .. value .. ']'
        end,
        modrinth_link = function(value)
            return '[https://modrinth.com/project/' .. value .. '/ ' .. value .. ']'
        end,
        builtbybit_link = function(value)
            return '[https://builtbybit.com/resources/' .. value .. '/ ' .. value .. ']'
        end,
        spigot_link = function(value)
            return '[http://www.spigotmc.org/resources/' .. value .. '/ ' .. value .. ']'
        end,
        grade_link = function(value)
            return '[[' .. value .. ']]'
        end,
        revision_date = function()
            return '{{REVISIONDAY}}/{{REVISIONMONTH}}/{{REVISIONYEAR}}'
        end
     }
     }
}
}


return config
return config

Version du 1 octobre 2025 à 12:48

La documentation pour ce module peut être créée à Module:Infobox/Configs/Plugin/doc

local config = {
    titre = function(args) 
        return args.nom or '{{PAGENAME}}' 
    end,
    
    icone = {
        type = 'fas',
        nom = 'puzzle-piece'
    },
    
    image = function(args) 
        if args.image then
            return {
                nom = args.image,
                taille = args.tailleimage or "280x200px",
                legende = args.legende or args.nom or '{{PAGENAME}}'
            }
        end
        return nil
    end,

    -- Configuration du champ "type" (utilisée par le Core)
    typeField = {
        required = true,
        allowedValues = {
            ['économie'] = {
                display = 'Économie',
                category = 'Plugins d\'économie'
            },
            ['pvp'] = {
                display = 'PvP', 
                category = 'Plugins de PvP'
            },
            ['roleplay'] = {
                display = 'Roleplay',
                category = 'Plugins de roleplay'
            },
            ['administration'] = {
                display = 'Administration',
                category = 'Plugins d\'administration'
            },
            ['protection'] = {
                display = 'Protection',
                category = 'Plugins de protection'
            },
            ['cosmétique'] = {
                display = 'Cosmétique',
                category = 'Plugins cosmétiques'
            },
            ['communication'] = {
                display = 'Communication',
                category = 'Plugins de communication'
            },
            ['utilitaire'] = {
                display = 'Utilitaire',
                category = 'Plugins utilitaires'
            },
            ['mini-jeu'] = {
                display = 'Mini-jeu',
                category = 'Plugins de mini-jeux'
            },
            ['monde'] = {
                display = 'Monde',
                category = 'Plugins de monde'
            },
            ['inventaire'] = {
                display = 'Inventaire',
                category = 'Plugins d\'inventaire'
            },
            ['transport'] = {
                display = 'Transport',
                category = 'Plugins de transport'
            },
            ['magie'] = {
                display = 'Magie',
                category = 'Plugins de magie'
            },
            ['mob'] = {
                display = 'Mob',
                category = 'Plugins de mobs'
            }
        },
        errorMessage = 'Type de plugin non reconnu. Types autorisés : économie, pvp, roleplay, administration, protection, cosmétique, communication, utilitaire, mini-jeu, monde, inventaire, transport, magie, mob'
    },

    sections = {
        {
            champs = {
                { cle = 'type', label = 'Type' },
                { cle = 'dev', label = 'Développeur' },
                { cle = 'status', label = 'Statut' },
                { cle = 'grade', label = 'Grade requis' }
            }
        },
        {
            titre = 'Téléchargements',
            champs = {
                { cle = 'bukkit', label = 'Bukkit' },
                { cle = 'hangar', label = 'Hangar (PaperMC)' },
                { cle = 'modrinth', label = 'Modrinth' },
                { cle = 'builtbybit', label = 'BuiltByBit' },
                { cle = 'spigot', label = 'Spigot' },
                { cle = 'sources', label = 'Code source' }
            }
        },
        {
            titre = 'Compatibilité',
            champs = {
                { cle = 'dépendance', label = 'Dépendances' },
                { cle = 'compatibilité', label = 'Compatible avec' }
            }
        }
    }
}

return config