diff options
author | Ted Trask <ttrask01@yahoo.com> | 2017-02-27 16:14:04 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2017-02-27 16:14:04 +0000 |
commit | 48eeb5f3317a39fac1e821305e1e76975bccb5ca (patch) | |
tree | 48f9fb4b3e597a7699a33ed32ebd3a25000f8f20 | |
parent | a9069d3ad39c0658bff72c763aa1e5520663726f (diff) | |
download | acf-core-48eeb5f3317a39fac1e821305e1e76975bccb5ca.tar.bz2 acf-core-48eeb5f3317a39fac1e821305e1e76975bccb5ca.tar.xz |
Modify htmlviewfunctions to output item class for static content
Previously, class was not output unless item was in a form
-rw-r--r-- | lib/htmlviewfunctions.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/htmlviewfunctions.lua b/lib/htmlviewfunctions.lua index bfe68bc..4cee340 100644 --- a/lib/htmlviewfunctions.lua +++ b/lib/htmlviewfunctions.lua @@ -125,14 +125,22 @@ function mymodule.displayitem(myitem, page_info, header_level, name, group) mymodule.displayformitem(myitem, name, header_level, group) elseif myitem.type ~= "hidden" then if myitem.errtxt then - myitem.class = "error" + if myitem.class then + myitem.class = myitem.class.." error" + else + myitem.class = "error" + end end header_level = mymodule.displayitemstart(myitem, page_info, header_level) if 0 <= header_level then io.write(html.html_escape(myitem.label)) end mymodule.displayitemmiddle(myitem, page_info, header_level) - io.write("<p>"..string.gsub(html.html_escape(tostring(myitem.value)), "\n", "<br/>") .. "</p>\n") + class = "" + if myitem.class then + class = ' class="'..html.html_escape(myitem.class)..'"' + end + io.write("<p"..class..">"..string.gsub(html.html_escape(tostring(myitem.value)), "\n", "<br/>") .. "</p>\n") mymodule.displayitemend(myitem, page_info, header_level) end end @@ -142,7 +150,11 @@ function mymodule.displayformitem(myitem, name, header_level, group) myitem.name = name or myitem.name or "" if group and group ~= "" then myitem.name = group.."."..myitem.name end if myitem.errtxt then - myitem.class = "error" + if myitem.class then + myitem.class = myitem.class.." error" + else + myitem.class = "error" + end end if myitem.type ~= "hidden" and myitem.type ~= "group" then -- Set the id so the label 'for' can point to it |