Skip to main content

Module Retrieval Functions

These functions are responsible for retrieving different types of modules based on item ID and parent.
The $this->fm object is used to call these methods, suggesting they are part of a model or service class.

Module Types

The code retrieves various types of modules, including:
  • Text modules
  • Collapsable modules
  • Section title modules
  • Horizontal rule modules
  • Marquee modules
  • Quote modules
  • News modules
  • Dropdown modules
  • Download modules
  • Image modules
  • HTML modules
  • Video modules
  • Headline modules
  • PDF modules
  • Start modules
  • Newsletter modules
  • Gallery modules
  • Related modules
  • Event modules
  • Column start/end modules

Module Processing

Collapsable Modules

Collapsable modules are processed using the prepareModuleImages function:

Download Modules

Download modules are processed to include file and image information:
Gallery and image modules are processed similarly to collapsable modules:

Start Modules

Start modules are processed to include additional image information:

Module Merging

All processed modules are merged into a single array and sorted by their ‘top’ value:
The final $data['modules'] array contains all the processed modules sorted by their ‘top’ value, which likely represents their display order.

Helper Functions

getRelatedItemsByTag

This function retrieves related articles based on a tag ID:
int
The ID of the tag to fetch related articles for
array
An array of related articles

Specialized Modules

Related modules are processed to fetch and organize related items based on tags or specific article IDs:
Related modules can be based on tags or specific article IDs. The number of items can be limited using the num_items parameter.

Event Modules

Event modules are processed differently based on whether they are for future events or not:
Event modules handle both current and future events, with different processing logic for each type.

PDF Modules

PDF modules are processed to include additional image information:

Utility Functions

prepareModuleImages

This function is used to prepare images for various module types:

getArticleInfo

Used to retrieve and format article information:

getRelatedItemsByNormalTag

Retrieves related items based on a normal tag:

Language Handling

The code uses a language variable to determine which language version of content to display:
The system supports at least two languages, with MAIN_LANGUAGE and SECOND_LANGUAGE constants used to determine which content version to display.

Conclusion

This module management system provides a flexible way to handle various types of content modules, including text, images, events, related content, and more. It processes and organizes these modules based on their type and specific requirements, ultimately merging them into a single, sorted array for display. The system also handles multilingual content, allowing for easy switching between different language versions of the content.