Reuse improved CMS_HOOK_BLOCK_HELPER to help creation of block templates.

Fixed typo in basic auth login form.
This commit is contained in:
2016-02-18 16:13:58 +01:00
parent ff58593bff
commit fbda2c9eb2
11 changed files with 52 additions and 84 deletions

View File

@@ -6,17 +6,17 @@ note
deferred class
CMS_HOOK_BLOCK_HELPER
feature -- Factory
feature {NONE} -- Factory
template_block (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE): detachable CMS_SMARTY_TEMPLATE_BLOCK
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_response'.
template_block (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_cms_api: CMS_API): detachable CMS_SMARTY_TEMPLATE_BLOCK
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_cms_api'.
local
res: PATH
p: detachable PATH
do
create res.make_from_string ("templates")
res := res.extended ("block_").appended (a_block_id).appended_with_extension ("tpl")
p := a_response.api.module_theme_resource_location (a_module, res)
p := a_cms_api.module_theme_resource_location (a_module, res)
if p /= Void then
if attached p.entry as e then
create Result.make (a_block_id, Void, p.parent, e)
@@ -26,6 +26,20 @@ feature -- Factory
end
end
template_block_with_values (a_module: CMS_MODULE; a_block_id: READABLE_STRING_8; a_cms_api: CMS_API; a_values: STRING_TABLE [ANY]): like template_block
-- Smarty content block for `a_block_id' in the context of `a_module' and `a_cms_api',
-- With additional `a_values'.
do
Result := template_block (a_module, a_block_id, a_cms_api)
if Result /= Void then
across
a_values as ic
loop
Result.set_value (ic.item, ic.key)
end
end
end
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"