Modules_Content
Trait for managing modular content in a content management system
The Modules_Content
trait provides functionality for managing modular content within articles or pages. It handles operations such as cloning, editing, and saving various types of content modules.
Key Properties
An array of module types supported by the system (e.g., ‘text’, ‘image’, ‘gallery’).
Multiple arrays (one for each module type) defining the data fields for each module type.
Arrays defining related item fields for certain module types (if applicable).
Main Methods
module_editor(parent = PARENT_ARTICLE)
Prepares data for the module editor interface.
clone_universal(type = ‘noarticle’, hasTeasers = 1, $name = ‘name’)
Clones an entity and its associated content, including articles and teaser images.
clone_item($itemId)
Clones a specific item and its associated modules.
clone_item_from_entity(article_related = false, type_name = false, $newOriginalItemId = false)
Clones an item from an entity, with options for handling related articles and language versions.
save_item()
Saves all modules associated with an item.
Utility Methods
camelCaseMe($item)
Converts a string to camelCase.
collectModuleIds(itemId, $parent)
Collects all module IDs of a specific type for an item.
addUpdateModule(moduleIds, module, relatedItemsDataKeys = array())
Adds or updates a module and its related items.
deleteModuleByType(editedIds, related_items = false)
Deletes modules that are no longer present in the edited set.
saveSpecificModuleForItem(parent, originalIds, relatedItemsDataKeys = array(), $relatedItems = ”)
Saves a specific module for an item.
checkErrorsAndGetRelated($moduleType)
Checks for errors and retrieves related item keys for a module type.