Hiding
By default, Brightspot displays the following standard widgets in the Content Edit Page: References, Revisions, SEO, Sites, Template, and URLs. Some of these widgets appear depending on an item's state. For example, the Revisions widget appears only after you save a draft, change a workflow state, or publish an item. In addition, Brightspot automatically displays any custom widgets created for the content edit page. (For information about creating custom widgets for the content edit page, see Creating and Creating updating content edit widgets.)
You can hide widgets at the content-type level and at the custom widget level.
Hiding widgets at the content-type level
You can hide the standard or custom widgets at the content-type level. For example, you can show the URLs widget on content edit pages for articles, and hide the widget on content edit pages for images.
The interface ContentEditWidgetDisplay contains a method shouldDisplayContentEditWidget
that you can override to specify if a widget is visible or not in a content edit page. You implement the interface at the model level, which gives you the flexibility for showing or hiding widgets depending on content type. The following example shows how to hide the standard URLs widget in an article's content edit page.
import com.psddev.cms.db.Content; import com.psddev.cms.db.ToolUi; import com.psddev.cms.tool.ContentEditWidgetDisplay; import com.psddev.cms.tool.content.UrlsWidget; import com.psddev.dari.db.Recordable; public class Article extends Content implements ContentEditWidgetDisplay { @Recordable.Required private String headline; @ToolUi.RichText private String body; @Override public boolean shouldDisplayContentEditWidget(String widgetName) { 1 if (widgetName.equals(UrlsWidget.class.getName())) { return false; } else { return true; } } }
Implements the method |

Hiding custom widgets
If you create a custom widget, you can hide it from the content edit page—regardless of the content type—by overriding the shouldDisplay
method in the widget's definition.
import com.psddev.cms.tool.ContentEditWidget; import com.psddev.cms.tool.ContentEditWidgetPlacement; import com.psddev.cms.tool.ToolPageContext; public class CurrentTimesWidget extends ContentEditWidget { @Override public void display(ToolPageContext page, Object content, ContentEditWidgetPlacement placement) throws IOException { 1 page.writeStart("p"); page.writeHtml("My widget for personal notes."); page.writeEnd(); /* p */ } public ContentEditWidgetPlacement getPlacement(ToolPageContext page, Object content) { return ContentEditWidgetPlacement.BOTTOM; } public String getHeading(ToolPageContext page, Object content) { return "My Custom Widget"; } @Override public boolean shouldDisplay(ToolPageContext page, Object content) { 2 return false; } }
![]() Figure 163. Custom widget shown | ![]() Figure 164. Custom widget hidden |