This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure. |
This module implements no template . ATM it serves only testing purposes for Module:SFfield/class
Usage[Quelltext bearbeiten]
{{#invoke:SFfield|function_name}}
local p = {}
local getArgs = require('Module:Arguments').getArgs
local classSFfield = require('Module:SFfield/class')
local classDebug = require('Module:Debug/class')
function p.printField(frame)
local name = mw.ustring.lower(frame.args[1] or frame.args.name)
local field = classSFfield:new(name)
classSFfield:setDefaultSize(20)
field:set('input type', 'textarea')
field:set('hidden')
field:set('qunique')
field:set('unique')
field:set('autogrow', false)
local field2 = classSFfield:new(name .. '2')
field2:set('list')
field2:set('show on select', 'trallalla')
local field3 = classSFfield:new(name .. '3')
field3:set('input type', 'dropdown')
field3:set('show on select', {hallo = 'welt', foo = 'bar'})
local str = field:render() .. '<br>' .. field2:render() .. '<br>' .. field3:render()
html = mw.html.create('table')
html:attr('class', 'formtable')
:node(field:createTr('Field1', 'This is tooltip 1'))
:newline()
:node(field2:createTr('Field2', 'This is tooltip 2'))
:newline()
:node(field3:createTr('Field3', 'This is tooltip 3'))
:newline()
str = str .. '\n' .. classDebug:printLog(3, 'pre') .. '\n'
return str .. tostring(html)
end
return p