Content Hooks
Table of Contents:
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 | site |
SiteInfoDatabase_TableList | site |
SiteInfoDatabase_TableList_TableListRow[Connect]:Before | site |
SiteInfoOverview | site |
SiteInfoOverview:Before | site |
SiteInfoOverview_TableList | site |
SiteInfoOverview_TableList:Before | site |
SiteInfo_TabNav_Items | site |
SiteInfo_Top_TopRight | site siteStatus |
SitesSidebar_SitesSidebarSites:Before | |
SitesSidebar_SitesSidebarSites | |
SiteInfoSSL | site |
SiteInfoSSL_TableList | site |
SiteInfoUtilities | site |
SiteInfoUtilities_TableList | site |
routesRootAccepts 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] |