Formulas

f_basic

firstChildID

The name says it all: retrieve the first child ID of a given ID.

No preview available.

getContextSetting

Retrieve a specific setting from a context of choice. Useful if you want to "borrow" a setting from another context, e.g. the correct site_url for assets only available in that context.

No preview available.

getElementDescription

Retrieve the description of an element. Used in the front-end library to prevent having to enter the same information twice. This paragraph is also loaded with getElementDescription!

No preview available.

getRawTVValue

Get the raw value of a TV. Usually when retrieving a TV value, it gets processed first before being returned. But sometimes you need the unprocessed value instead, e.g. when using @inherit.

No preview available.

getTmplvarID

Get the ID of a TV, in case you only know its name. Created for the front-end library, to help with listing included TVs.

No preview available.

returnFirstHit

Feed it a bunch of properties and it spits out the first one that's not empty. Property names are irrelevant. Sort order is all that matters.

No preview available.

f_content

tableOfContents

No preview available.

f_contentblocks

cbHasFields

This is a copy of the original cbHasField snippet that ships with ContentBlocks. The only difference is that it takes in a comma separate list of IDs, instead of just 1.

No preview available.

cbRenderCodeField

For use in a CB Code field, together with a field setting to control how the :tag modifier is rendered. Useful for dealing with MODX tags inside a Code field, i.e. when writing documentation.

No preview available.

f_formblocks

fbFormReport

Generates a report from submitted field values. Primarily for emails, but you can also use this snippet to template other kinds of functionality (confirmation pages, multi page forms..).

No preview available.

fbGetForms

No preview available.

fbInputRepeater

Parse the HTML output of repeating form fields and remember the submitted values of each field, in case the page is reloaded.

No preview available.

fbLoadAssets

No preview available.

fbValidateProcessJSON

Generates the correct strings for the FormIt &validate property.

No preview available.

f_fb_hook

fbEmptyHook

Dummy hook to trick FormIt into not throwing errors saying there are no hooks, and to make the comma separation between hooks a little easier.

No preview available.

fbSetStoredValues

Populate field values with available data stored in the user session. Enabled by default when using multi-page forms.

No preview available.

f_fb_modifier

fbResetNonAlpha

No preview available.

fbStripAsAlias

No preview available.

fbStripNonAlpha

No preview available.

f_framework

FibonacciSequence

Generate a sequence of Fibonacci numbers. In a Fibonacci sequence, every number after the first two is the sum of the two preceding ones.

No preview available.

modifiedIf

Customized If snippet with additional 'contains', 'containsnot' and 'isnumeric' operators, output to placeholder and option to prevent chunks from parsing before If statement is evaluated.

No preview available.

setBackground

Output the necessary class names for the applied Global Background.

No preview available.

setBoxType

Output the necessary class names for Overview patterns, based on their template. It was created because the chunks where getting a bit swamped by output modifiers trying to do the same thing.

No preview available.

f_hub

assignedTVs

No preview available.

includedBosons

No preview available.

includedChunks

No preview available.

includedSnippets

No preview available.

includedTVs

No preview available.

referringBosons

No preview available.

setPatternPlaceholders

No preview available.

setPatternType

No preview available.

f_json

jsonGetObject

Search a JSON object for specific item and return the entire array. This is initially intended to turn CB repeater elements into CSS, without having to change the internal templating in CB.

No preview available.

jsonGetValue

Get the value of a specific key from a JSON string.

No preview available.

jsonImportInputOptions

Generate input options from a JSON file. These options are written directly into their database table inside the Backyard package.

No preview available.

jsonToHTML

Turn a JSON object into an HTML table. For documentation purposes.

No preview available.

stripForJSON

Prepare the input for being used in JSON. This means escaping backslashes and double quotes.

No preview available.

tvToJSON

Output the properties of given TV to a JSON object. The output could be used by jsonToHTML to generate an HTML table.

No preview available.

f_modifier

beforeEach

Grab a comma-separated list and prefix all items with given value. Optionally, the separator can be changed and output can be forwarded to a placeholder.

No preview available.

clipString

Trim the edges of a string. The given value represents the number of characters that will be clipped. If the value is negative, they will be clipped from the end of the string.

No preview available.

filterLine

Search the input for lines containing a specific string. And then return those lines.

No preview available.

parseTags

Take in a comma separated string and turn each value into a separate tag. Sometimes you just need that :)

No preview available.

removeDuplicateLines

Scan input for duplicate lines and remove them from the output.

No preview available.

replaceRegex

Find patterns with regex and replace them. By default, it removes all matches. If you want to replace each match with something else, you have to use a regular snippet call.

No preview available.

round

Round a decimal value to a whole number or with a specified amount of decimals. Usage: returns the value with 2 decimals, returns a whole number.

No preview available.

splitString

Divide string into multiple sections, based on a delimiter. Regular snippet call outputs sections to placeholders. If used as output modifier, specify the number of the part you want to get.

No preview available.

stripAsAlias

Turn input into lowercase-hyphen-separated-alias-format and strip unwanted special characters. Useful for creating anchor links based on headings, for example.

No preview available.

stripForJS

Prepare the input for use in Javascript. This means escaping certain characters to make sure the surrounding HTML doesn't break.

No preview available.

stripWords

As opposed to the native MODX stripString modifier (which only allows you to strip a single value), stripWords lets you enter multiple (comma separated) values.

No preview available.

textToNumber

Turn a written number into an actual numeric value. In other words: turn "three" into "3". Can come in handy if you want to use the Semantic UI column width classes for other purposes.

No preview available.

f_performance

generateCriticalCSS

Utility snippet to determine which CSS styles are used above the fold and write them to a custom CSS file. This needs NPM and the critical package to be installed.

No preview available.

generateStaticFile

Create a physical HTML file of a resource in the designated location. This is a utility snippet. Place it in the content somewhere and visit that page in the browser to generate the file.

No preview available.

imgOptimizeThumb

Post hook for pThumb, that runs after the thumbnail is generated. It uses the Squoosh library from Google to create a WebP version of the image and optimize the original.

No preview available.

f_presentation

getImageDimensions

Retrieve width and height from physical image files. Auto detects SVGs.

No preview available.

getVimeoData

Retrieve the largest existing thumbnail image available. You can choose between JPG and webP extension. Can be used as output modifier as well.

No preview available.

getYoutubeThumb

Retrieve the largest existing thumbnail image available. You can choose between JPG and webP extension. Can be used as output modifier as well.

No preview available.

iconInputOptions

Generate input options with all Semantic UI icon classes.

No preview available.

loadAssets

Load CSS and JS for a specific component. Some assets are included in semantic.css by default, to keep its file size down.

No preview available.

responsiveImgSrcset

Generate a number of srcset properties, for use inside an img tag.

No preview available.

sliderLoadAssets

Load CSS and JS dependencies for Swiper slider. It also initializes a Swiper instance for each slider, with it's own parameters. This means you can use multiple sliders on one page.

No preview available.

statusGridLoadAssets

Load CSS and JS dependencies for status grid.

No preview available.

stepsLoadAssets

Load CSS styles for Steps component. This is not included in semantic.css by default, to keep its file size down.

No preview available.

tabsGenerateNav

Generate the tab buttons based on data-heading attribute in the tabs themselves. It basically links every tab button to the correct tab content.

No preview available.

f_resource

getChildCount

Return the amount of child pages a resource has. Now you can make one of those shiny little badges inside a menu button, telling the user upfront how much treasure is inside.

No preview available.

getResourceLevel

Show the level of a given resource based on the number of parent IDs. Useful for example if you only want to show a breadcrumb trail on pages that are two or three levels deep.

No preview available.

renderContentType

Takes an ID as input and returns the content type. Mainly intended as snippet renderer for Collections, but can be used independently or as output modifier too.

No preview available.

renderResourceName

Takes an ID as input and returns the pagetitle. Mainly intended as snippet renderer for Collections, but can be used independently or as output modifier too.

No preview available.

resourceMediaPath

Standalone version of a snippet that comes with MIGX. Generates subfolders in media sources. Keeps your folder structure tidy when adding lots of images in lots of resources (e.g. galleries).

No preview available.

resourceTVInputOptions

Generate input option values that can be used in TVs, for creating resource selectors.

No preview available.

SeoTabIndexation

If SeoTab (StercSEO) is installed, this snippet displays the indexation setting for given resource.

No preview available.

f_toolshed

migxResetNULL

After save hook for MIGXdb. Prevents database fields with default value of NULL from being set to 0 after a save action in MIGX.

No preview available.

migxSaveOption

Aftersave hook for MIGXdb. Gets and sets the group (parent) ID inside a nested configuration. Also generates an alias if none is present and increments the sort order.

No preview available.

migxSaveOptionGroup

Aftersave hook for MIGXdb. Updates existing keys in child options if you change this setting in Group. Also increments the sort order.

No preview available.

migxSaveRelated

Aftersave hook for MIGXdb. Sets source and target IDs in opposite direction also, to establish a double cross-link. Yeah, better watch your back with those!

No preview available.

migxSaveRepurposeDest

Aftersave hook for MIGXdb. Sets current resource ID as re-purpose source.

No preview available.

migxSaveRepurposeSrc

Aftersave hook for MIGXdb. Sets current resource ID as re-purpose destination.

No preview available.

migxSaveTaskComment

Aftersave hook for MIGXdb. Links the comment to the parent task.

No preview available.

renderInputOption

Fetch option name from the romanesco_options table (when used as output modifier). You can also get other available fields with a regular snippet call and tpl chunk.

No preview available.

f_user

checkPermissions

Check if user is allowed to access the given (or current) context and redirect to unauthorized page if that's not the case.

No preview available.

isEditor

Check if user is logged in to the manager.

No preview available.

renderUserName

Gets user by ID and returns the username. Mainly intended as snippet renderer for Collections, but can be used independently or as output modifier too.

No preview available.

setUserPlaceholders

Make any extended fields that are attached to a MODX user available as placeholder.

No preview available.