Class: ToolbarModel

Drupal.toolbar. ToolbarModel

new Drupal.toolbar.ToolbarModel()

Backbone model for the toolbar.

Extends

  • Backbone.Model

Members

activeTabstring

The active toolbar tab. All other tabs should be inactive under normal circumstances. It will remain active across page loads. The active item is stored as an ID selector e.g. '#toolbar-item--1'.

activeTraystring

Represents whether a tray is open or not. Stored as an ID selector e.g. '#toolbar-item--1-tray'.

areSubtreesLoadedbool

Menu subtrees are loaded through an AJAX request only when the Toolbar is set to a vertical orientation.

defaultsobject

Properties:
Name Type Description
activeTab
activeTray
isOriented
isFixed
areSubtreesLoaded
isViewportOverflowConstrained
orientation
locked
isTrayToggleVisible
height
offsets

heightnumber

The height of the toolbar.

isFixedbool

Indicates whether the toolbar is positioned absolute (false) or fixed (true).

isOrientedbool

Indicates whether the toolbar is displayed in an oriented fashion, either horizontal or vertical.

isTrayToggleVisiblebool

Indicates whether the tray orientation toggle is visible.

isViewportOverflowConstrainedbool

If the viewport overflow becomes constrained, isFixed must be true so that elements in the trays aren't lost off-screen and impossible to get to.

lockedbool

A tray is locked if a user toggled it to vertical. Otherwise a tray will switch between vertical and horizontal orientation based on the configured breakpoints. The locked state will be maintained across page loads.

offsetsobject

The current viewport offsets determined by Drupal.displace. The offsets suggest how a module might position is components relative to the viewport.

Properties:
Name Type Description
top number
right number
bottom number
left number

orientationstring

The orientation of the active tray.

Methods

validate(attributes, options){string|undefined}

Name Type Description
attributes object

Attributes for the toolbar.

options object

Options for the toolbar.

Returns:
Type Description
string | undefined Returns an error message if validation failed.