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

moduleNames
array

An array of module types supported by the system (e.g., ‘text’, ‘image’, ‘gallery’).

*DataKeys
array

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(itemId,itemId, parent = PARENT_ARTICLE)

Prepares data for the module editor interface.

clone_universal(entityId,entityId, type = ‘noarticle’, noarticletype=false,noarticle_type = false, 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(itemId,itemId, article_related = false, newEntityId=false,newEntityId = 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(type,type, itemId, $parent)

Collects all module IDs of a specific type for an item.

addUpdateModule(type,type, moduleIds, datakeys,data_keys, module, relateditems=,related_items = '', relatedItemsDataKeys = array())

Adds or updates a module and its related items.

Deletes modules that are no longer present in the edited set.

saveSpecificModuleForItem(module,module, parent, type,type, originalIds, dataKeys,dataKeys, relatedItemsDataKeys = array(), $relatedItems = ”)

Saves a specific module for an item.

checkErrorsAndGetRelated($moduleType)

Checks for errors and retrieves related item keys for a module type.