Skip to main content

buildfire.navigation

Navigate to other plugins, home, or even an external web page.

Methods

buildfire.navigation.navigateTo(pluginData)

Use this method to navigate away to a different plugin. This is used commonly in Launcher or Folder type plugins.

buildfire.navigation.navigateTo({
instanceId: "YOUR_INSTNACE_ID_HERE",
});

pluginData

NameTypeRequiredDescriptionDefault
pluginIdstringyes if there is no instanceIdThe id of the plugin type you'd like to navigate to.
instanceIdbooleannoInstance id of the plugin type you'd like to navigate to.
folderNamenumbernoThe folder name of the plugin that you'd like to navigate to.
titlestringnoThe title that should show up in the title bar once the plugin is loaded.
queryStringstringnoQuery string that will be passed to the next plugin's window.location.search ex` "name=Larry&age=36&showDetails=true"
note

At minimum either the plugin id or the instance id must be provided. If a plugin id is passed without an instance id then the first instance of the specified plugin type will be navigated to.


buildfire.navigation.navigateToSocialWall(options, callback)

This method is quick shortcut to navigate to community wall plugins without having to specify the community wall plugin type id. A common use for it is to navigate to any social wall instance without having to specify an instance id or a plugin type id. If no community wall instance is found, it will try to look for a premium social wall instance. If not, lastly will check for a social wall instance.

buildfire.navigation.navigateToSocialWall(
{
title: "Wall title",
},
(err, result) => {
if (err) return console.error(err);

console.log("NAVIGATION FINISHED");
}
);

options

NameTypeRequiredDescriptionDefault
titlestringnoThe title that should show up in the title bar once the plugin is loaded.
queryStringstringnoQuery string that will be passed to the next plugin's window.location.search
wallUserIds[string]noArray of user ids you want to create a wall id for, where the generated wall id for social users will be appended to the options.querystring
pluginTypeOrder[string]noThe developer can use this option to change the default order we will be using to look for instances based on the type (community wall => premium social wall => social wall). Index 0 has the highest priority.['community', 'premium_social', 'social']

callback(err, result)

Callback function after navigation is finished

NameTypeDescription
errstringError string, null when operation is successful
resultobject{ status: "completed" }

buildfire.navigation.navigateHome()

Closes out the current plugin and navigates to the Home Plugin.

buildfire.navigation.navigateHome();

openWindow()

buildfire.navigation.openWindow(url, target, callback)

Opens a web page in the app browser or in the system browser

buildfire.navigation.openWindow("https://google.com", "_system");

options

NameTypeRequiredDescriptionDefault
urlstringyesThe url of the web page you'd like to open
targetstringno_blank for Widget opens in app browser, or _system (Widget only) opens in system browser_blank

callback(err)

Callback function when the window closes on widget side. Will fire immediately on Control side


onBackButtonClick()

buildfire.navigation.onBackButtonClick()

This handler will be called when the user clicks on the back button on the title bar or hits the back button on their phone (if applicable). You can override this handler to modify they behavior within your own plugin.

buildfire.navigation.onBackButtonClick = () => {
console.log("BACK BUTTON CLICKED");
};

restoreBackButtonClick()

buildfire.navigation.restoreBackButtonClick()

This function will restore the original functionality of buildfire.navigation.onBackButtonClick if it was overridden.

buildfire.navigation.restoreBackButtonClick();

goBack()

buildfire.navigation.goBack()

This function will trigger the Back functionality.

buildfire.navigation.goBack();

buildfire.navigation.makeSafeLinks(element)

Parses the external links and makes them open up in In App Browser, otherwise a link will open in the app itself and the user can't find a way to go back to the app. This is used commonly after assigning the data from WYSIWYG control in your widget.

buildfire.navigation.makeSafeLinks("my_container_div");

element

NameTypeRequiredDescriptionDefault
elementstring or ElementyesId of the container element, or the element itself

More Examples

let element = document.getElementById("my_container_div");
buildfire.navigation.makeSafeLinks(element);

scrollTop()

buildfire.navigation.scrollTop()

Use this method to have the containing Control Panel page to scroll up to the top. This is usually used when hiding and showing content in the plugin that may cause the page to scroll down further than the content.

buildfire.navigation.scrollTop();

buildfire.navigation.navigateToTab(options, callback)

This method provides the users a way to navigate the CP's tabs through the SDK, with the ability to pass deeplink data.

buildfire.navigation.navigateToTab(
{
tabTitle: "Content",
deeplinkData: { username: "John"}
},
(err) => {
if (err) return console.error(err); // `Content` tab was not found

console.log("NAVIGATION FINISHED");
}
);

options

NameTypeRequiredDescriptionDefault
tabTitlestringyesThe title of the tab that the user wants to navigate to, this is case insensitive.
deeplinkDataobjectnoAn object which contains the deeplink data the user wants to pass to the opened tab.

callback(err)

Callback function after navigation is finished

NameTypeDescription
errstringError string, null when operation is successful

Events

onAppLauncherActive()

onAppLauncherActive(callback, allowMultipleHandlers)

Gets fired when a user navigates back to the launcher plugin instance, this can only be used in a launcher plugin.

buildfire.navigation.onAppLauncherActive(() => {
console.log("Launcher plugin became active");
});

callback()

Callback function after navigation is finished

allowMultipleHandlers

NameTypeRequiredDescriptionDefault
allowMultipleHandlersbooleannoTells the method to override all other handlers, or allow multiple handlers to exist at the same time.false

onAppLauncherInactive()

onAppLauncherInactive(callback, allowMultipleHandlers)

Gets fired when a user leaves the launcher plugin instance, this can only be used in a launcher plugin.

buildfire.navigation.onAppLauncherInactive(() => {
console.log("Launcher plugin became inactive");
});

callback()

Callback function after navigation is finished

allowMultipleHandlers

NameTypeRequiredDescriptionDefault
allowMultipleHandlersbooleannoTells the method to override all other handlers, or allow multiple handlers to exist at the same time.false