Support and Documentation

Conditionally displaying classes in widgets

Brightspot displays classes in almost every widget—the content edit form, the search panel, Edit Site, and many other places. You can conditionally show or hide a class or its instances depending depending on Brightspot's state at run time by implementing the abstract method ClassDisplay#shouldHide.

For example, when doing a federated search, editors can select from external content providers appearing in the External Types section of content type filter.


If your instance of Brightspot is not integrated with a particular service, you should prevent it from appearing in the External Types list by implementing ClassDisplay#shouldHide. If this method returns true, Brightspot hides the class from the display; if it returns false, Brightspot shows the class in the display.

import com.psddev.cms.tool.ClassDisplay;
import com.psddev.dari.util.ObjectUtils;

public class VimeoClassDisplay implements ClassDisplay {

    public boolean shouldHide(Class<?> instanceClass) {

        /* Ensure the current class is a subclass of VimeoVideo */
        if (VimeoVideo.class.isAssignableFrom(instanceClass)) {
            VimeoSettings settings = VimeoUtils.getSettings();

            /* Ensure the API key and secret are configured for the Vimeo service */
            return ObjectUtils.isBlank(settings.getApiKey()) || ObjectUtils.isBlank(settings.getApiSecret());
        return false;

In the previous snippet, Brightspot shows instances of VimeoVideo if the passed class is a subclass of VimeoVideo of the current class AND the API key and secret values are configured for the Vimeo service.