> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlecker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

<ResponseField name="moduleNames" type="array">
  An array of module types supported by the system (e.g., 'text', 'image', 'gallery').
</ResponseField>

<ResponseField name="*DataKeys" type="array">
  Multiple arrays (one for each module type) defining the data fields for each module type.
</ResponseField>

<ResponseField name="*RelatedItemsKeys" type="array">
  Arrays defining related item fields for certain module types (if applicable).
</ResponseField>

## Main Methods

### module\_editor($itemId, $parent = PARENT\_ARTICLE)

Prepares data for the module editor interface.

### clone\_universal($entityId, $type = 'noarticle', $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, $article\_related = 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, $itemId, \$parent)

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

### addUpdateModule($type, $moduleIds, $data_keys, $module, $related_items = '', $relatedItemsDataKeys = array())

Adds or updates a module and its related items.

### deleteModuleByType($originalIds, $editedIds, $type, $related\_items = false)

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

### saveSpecificModuleForItem($module, $parent, $type, $originalIds, $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.
