Class: StateModel

Drupal.contextualToolbar. StateModel

new Drupal.contextualToolbar.StateModel(attrs, options)

Models the state of the edit mode toggle.

Name Type Description
attrs object

Attributes for the backbone model.

options object

An object with the following option:

Name Type Description
contextualCollection Backbone.collection

The collection of Drupal.contextual.StateModel models that represent the contextual links on the page.

Extends

  • Backbone.Model

Members

contextualCountnumber

Tracks how many contextual links exist on the page.

defaultsobject

Properties:
Name Type Description
isViewing bool
isVisible bool
contextualCount number
tabbingContext Drupal~TabbingContext

isViewingbool

Indicates whether the toggle is currently in "view" or "edit" mode.

isVisiblebool

Indicates whether the toggle should be visible or hidden. Automatically calculated, depends on contextualCount.

nullabletabbingContextDrupal~TabbingContext

A TabbingContext object as returned by Drupal~TabbingManager: the set of tabbable elements when edit mode is enabled.

Methods

Tracks the number of contextual link models in the collection.

Name Type Description
contextualModel Drupal.contextual.StateModel

The contextual links model that was added or removed.

contextualCollection Backbone.Collection

The collection of contextual link models.

Lock newly added contextual links if edit mode is enabled.

Name Type Description
contextualModel Drupal.contextual.StateModel

The contextual links model that was added.

contextualCollection Backbone.Collection optional

The collection of contextual link models.

Automatically updates visibility of the view/edit mode toggle.