Filters

Filters enable easily modifying data that is passed around in Local. Much like WordPress' filters, all filters in Local must return a value.

Available Filters

Filter Name

appMenu

Description

Allows you to add or modify items in the main app menu (top bar menu)

Callback Function Parameters

  • macOS Menu Template

  • Current Platform provided by process.platform

function(menu: MenuTemplate[], platform: string): MenuTemplate[];

_____________________________________________________________

Filter Name

siteInfoMoreMenu

Description

Allows you to add menu items to the Site Info More menu inside of a single site view.

Callback Function Parameters

Example

_____________________________________________________________

Filter Name

preferencesMenuItems

Description

Add-ons have the ability to add items to Local's preferences section by using the preferencesMenuItems filter hook. This filter will add a new item to the left hand column of all Preferences views and allow add-ons to add their own content section.

An AddonSettingsItem object is given to Local via the preferencesMenuItems hook (see usage examples below). This can then render an array of PreferencesSection's or any React component. The latter is provided mainly as an escape hatch in the case that an add-on needs more flexibility. Each PreferencesSection then provides an optional header and a single or array of MenuContentRowItem(s).

Props passed to <Row /> or <Override /> components

Callback Function Parameters

  • preferencesMenu

Examples

"Standard" example passing in sections and sub-headers

Overriding Sections with a single React Component (allows you to render arbitrary things in the "content area")

Environment Filters

Filter Name

Parameters

importBlueprintSiteSettings:ENV_ID:ENV_VERSION

Last updated