Brightspot CMS Developer Guide


The content edit form typically includes three tabs: Main, Overrides, and SEO. (Other tabs are available depending on the content type and Brightspot’s configuration.) You can add custom tabs to the content edit form.

The interface Tab specifies methods for displaying the tab, the tab’s contents, and a callback for an update event. The following sections describe how to implement these methods.

This interface is available for embedded objects displayed in the content edit form.

The following snippet illustrates how to declare a class that displays a tab in the content edit form and how to populate the tab with a label and text.

import com.psddev.cms.tool.Tab;
import com.psddev.cms.tool.ToolPageContext;

public class TimeZonesTab implements Tab { 

    public void onUpdate(ToolPageContext page, Object content) { }

    public String getDisplayName() { 
        return "Local Times";

    public boolean shouldDisplay(Object o) { 
        return true;

    public void writeHtml(ToolPageContext page, Object o) throws IOException { 

        Map<String, String> timeZoneIdentifiers = new HashMap<>();
        timeZoneIdentifiers.put("New York", "America/New_York");
        timeZoneIdentifiers.put("Los Angeles", "America/Los_Angeles");
        timeZoneIdentifiers.put("Mexico City", "America/Mexico_City");


                page.writeEnd(); /* th */
                page.writeEnd(); /* th */
            page.writeEnd(); /* tr */

            for (String myTimeZone : timeZoneIdentifiers.keySet()) {
                    page.writeEnd(); /* td */
                        String localTime = displayTime(timeZoneIdentifiers.get(myTimeZone));
                    page.writeEnd(); /* td */
                page.writeEnd(); /* tr */
        page.writeEnd(); /* table */

    private String displayTime(String timeZoneIdentifier) {
        Calendar localTime = new GregorianCalendar(TimeZone.getTimeZone(timeZoneIdentifier));
        int hour = localTime.get(Calendar.HOUR_OF_DAY);
        int minute = localTime.get(Calendar.MINUTE);
        return (hour + ":" + minute);
  • Declares the class TimeZonesTab as an implementation of Tab. Any class implementing this interface appears as a tab in the content edit form.
  • Specifies the tab’s label text.
  • Indicates the tab always appears in the content edit form. For an example of conditionally displaying the tab, see Conditionally displaying a tab.
  • Two methods (writeHtml and displayTime) that generate a table of localized UTC times. For an explanation of these methods, see the snippet "Implementing a custom widget in content edit page."

The following illustration shows a tab’s label and custom text.

Custom tab

You can use the method Tab#shouldDisplay to show or hide a custom tab based on the passed object or any other object you can access.

public boolean shouldDisplay(Object content) {
    return (content instanceof Article); 
  • Tests if the current object is of type Article; if so, Brightspot displays the custom tab.

Every change in the content edit form (even before clicking Publish) calls the method Tab#onUpdate. You can use this method to dynamically update the database without requiring the user to click Publish.

public void onUpdate(ToolPageContext page, Object content) { 
    State state = State.getInstance(content); 
    updateFields(page, state); 
  • Traps updates to the content edit form and receives an object representing the current page and another object representing the content.
  • Instantiates a State object corresponding to the current object.
  • Passes the content and state objects to a private method (not shown) that updates the database.

Previous Topic
Content edit widgets
Next Topic
Profile tabs
Was this topic helpful?
Thanks for your feedback.
The elements that get you up and running in a matter of days, from pre-built content types, to modules, to landing pages.

Content types
Landing pages
Everything you need to manage and administer content within Brightspot CMS, including plug-and-play integrations.

Admin configurations
A guide for installing, supporting and administering code on the Brightspot platform, including integrations requiring developer support to use.

Field types
Content modeling
Rich-text elements