> ## 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.

# Helper_Frontend

> A trait containing various helper functions for frontend operations

## Event Visibility

### getVisibleEvent

Determines if an event should be visible based on its visibility settings.

<ParamField path="event" type="object">
  The event object to check visibility for
</ParamField>

<ResponseField name="return" type="object|false">
  Returns the event object if visible, false otherwise
</ResponseField>

## Google Analytics

### googleAnalytics

Sends pageview data to Google Analytics.

<ParamField path="analytics" type="object">
  The Google Analytics service object
</ParamField>

### getResults

Retrieves session data from Google Analytics for the last 7 days.

<ParamField path="analytics" type="object">
  The Google Analytics service object
</ParamField>

<ParamField path="profileId" type="string">
  The Google Analytics profile ID
</ParamField>

### printResults

Prints the results from a Google Analytics query.

<ParamField path="results" type="object">
  The results object from a Google Analytics query
</ParamField>

## Event Management

### get\_events\_with\_js\_return

Retrieves events for a specific date and returns them as JSON.

<ResponseField name="return" type="json">
  JSON object containing the formatted date and event items
</ResponseField>

## Filtering

### js\_filter

Prepares data for JavaScript-based filtering of webinars.

### get\_filter

Prepares data for filtering artworks.

### get\_filters\_for

Generates filter options for different types of items (case studies, projects, news, shop).

<ParamField path="type" type="string">
  The type of items to generate filters for
</ParamField>

<ParamField path="items" type="array">
  The array of items to generate filters from
</ParamField>

<ResponseField name="return" type="array">
  An array of filter options
</ResponseField>

## Image Handling

### getArtworkZoom

Retrieves zoom images for an artwork.

### upload\_image

Handles image upload and resizing.

### replace\_img

Replaces an existing image.

## Cookie Management

### set\_cookie

Sets a cookie with the given name and value.

<ParamField path="name" type="string">
  The name of the cookie
</ParamField>

<ParamField path="val" type="string">
  The value to set for the cookie
</ParamField>

### saveCookie

Saves cookie preferences.

## Email

### send\_internal\_email

Sends an internal email using PHPMailer.

<ParamField path="data" type="array">
  The data to be used in the email template
</ParamField>

<ResponseField name="return" type="string">
  Returns 'ok' on success, or an error message on failure
</ResponseField>

## Mailchimp Integration

### add\_to\_mailchimp

Adds an email address to a Mailchimp list.

### addToMailchimp

Adds a subscriber to a Mailchimp list with additional details.

<ParamField path="email" type="string">
  The subscriber's email address
</ParamField>

<ParamField path="firstname" type="string">
  The subscriber's first name
</ParamField>

<ParamField path="lastname" type="string">
  The subscriber's last name
</ParamField>

## Search Functionality

### getResultSearchString

Extracts and formats a snippet of text around a search term.

<ParamField path="item" type="object">
  The item containing the content to search
</ParamField>

<ParamField path="search_term" type="string">
  The term to search for
</ParamField>

<ResponseField name="return" type="string">
  A formatted string containing the search term and surrounding context
</ResponseField>

### search\_save

Saves a search term, updating its count if it already exists.

<ParamField path="tag_id" type="int|false" default="false">
  Optional tag ID associated with the search
</ParamField>
