Revisited the format, filter and content type integration.
Now, all formats used by CMS are instances of CMS_FORMAT, mainly to prepare the admin section in order to define format by config/database. CMS_NODE_API provides all queries to access the content types, and formats, this way a module can easily alter the formats by adding a new filter. TODO: see how to integrate permission checking, to control who can use a specific format (such as full HTML).
This commit is contained in:
@@ -52,9 +52,17 @@ feature {CMS_API} -- Module Initialization
|
||||
|
||||
node_api := l_node_api
|
||||
-- Depends on {CMS_NODE_MODULE}
|
||||
|
||||
create ct
|
||||
--| For now, add all available formats to content type `ct'.
|
||||
across
|
||||
l_node_api.available_content_formats as ic
|
||||
loop
|
||||
ct.extend_format (ic.item)
|
||||
end
|
||||
l_node_api.add_content_type (ct)
|
||||
l_node_api.add_content_type_webform_manager (create {CMS_BLOG_NODE_TYPE_WEBFORM_MANAGER}.make (ct))
|
||||
|
||||
-- Add support for CMS_BLOG, which requires a storage extension to store the optional "tags" value
|
||||
-- For now, we only have extension based on SQL statement.
|
||||
if attached {CMS_NODE_STORAGE_SQL} l_node_api.node_storage as l_sql_node_storage then
|
||||
|
||||
@@ -8,21 +8,6 @@ class
|
||||
|
||||
inherit
|
||||
CMS_NODE_TYPE [CMS_BLOG]
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
default_create
|
||||
do
|
||||
Precursor
|
||||
create {ARRAYED_LIST [like available_formats.item]} available_formats.make (4)
|
||||
available_formats.extend (create {PLAIN_TEXT_CONTENT_FORMAT})
|
||||
available_formats.extend (create {FILTERED_HTML_CONTENT_FORMAT})
|
||||
available_formats.extend (create {FULL_HTML_CONTENT_FORMAT})
|
||||
available_formats.extend (create {CMS_EDITOR_CONTENT_FORMAT})
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
@@ -35,11 +20,6 @@ feature -- Access
|
||||
description: STRING_32 = "Content published as a blog post."
|
||||
-- Optional description
|
||||
|
||||
feature -- Access
|
||||
|
||||
available_formats: LIST [CONTENT_FORMAT]
|
||||
-- Available formats for Current type.
|
||||
|
||||
feature -- Factory
|
||||
|
||||
new_node_with_title (a_title: READABLE_STRING_32; a_partial_node: detachable CMS_NODE): like new_node
|
||||
|
||||
Reference in New Issue
Block a user