Content Hooks

Content Hooks allow you to inject React components into various location in Local's UI. With Content Hooks you can do anything from adding additional buttons, table rows, or even new pages and routes.

Available Content Hooks

Hook Name

Parameters

stylesheets

SiteInfoDatabase

SiteInfoDatabase_TableList

SiteInfoDatabase_TableList_TableListRow[Connect]:Before

SiteInfoOverview

SiteInfoOverview:Before

SiteInfoOverview_TableList

SiteInfoOverview_TableList:Before

SiteInfo_TabNav_Items

SiteInfo_Top_TopRight

SitesSidebar_SitesSidebarSites:Before

SitesSidebar_SitesSidebarSites

SiteInfoSSL

SiteInfoSSL_TableList

SiteInfoUtilities

SiteInfoUtilities_TableList

routesRoot

Accepts React Router <Route /> components

routes[main]

Accepts React Router <Route /> components

routes[site-info]

Accepts React Router <Route /> components

Examples

Adding a React Component (source)

hooks.addContent('SiteInfoOverview', (site) => {
    return (
        <Notes key="notes" site={site} />
    );
});

Content Hooks are added to an array of React Components. This means all components need to have a key prop.

Adding a Route (source)

hooks.addContent('routesSiteInfo', () => {
    return (
        <Route 
            key="site-info-stats" 
            path="/site-info/:siteID/stats" 
            component={SiteInfoStats}
        />
    );
});

Environment Content Hooks

The following Content Hooks are meant to be used by Environments such as the Preferred and Custom Environment.

ENV_ID and ENV_VERSION are for illustrative purposes only and should be replaced with a static value or variable.

ENV_ID and ENV_VERSION are in the hook name to allow for multiple Environments to be loaded at the same time and to cut down on the number of conditionals required.

Hook Name

NewSiteEnvironment[ENV_ID][ENV_VERSION]_AddSiteContent_Inner

SaveBlueprintPage[ENV_ID][ENV_VERSION]_SettingsPane_TableList

SettingsNewSiteDefaults[ENV_ID][ENV_VERSION]

SiteInfoEnvironmentMySQL[ENV_ID][ENV_VERSION]

SiteInfoEnvironmentPHP[ENV_ID:ENV_VERSION]

SiteInfoEnvironmentWebServer[ENV_ID][ENV_VERSION]

Last updated