Class: StateModel

Drupal.contextualToolbar.StateModel(attrs, options)

new StateModel(attrs, options)

Models the state of the edit mode toggle.

Parameters:
Name Type Description
attrs object

Attributes for the backbone model.

options object

An object with the following option:

Properties
Name Type Description
contextualCollection Backbone.collection

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

Source:

Extends

  • Backbone.Model

Members

contextualCount :number

Tracks how many contextual links exist on the page.

Type:
  • number
Source:

defaults :object

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

isViewing :bool

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

Type:
  • bool
Source:

isVisible :bool

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

Type:
  • bool
Source:

(nullable) tabbingContext :Drupal~TabbingContext

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

Type:
Source:

Methods

Tracks the number of contextual link models in the collection.

Parameters:
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.

Source:

Lock newly added contextual links if edit mode is enabled.

Parameters:
Name Type Attributes Description
contextualModel Drupal.contextual.StateModel

The contextual links model that was added.

contextualCollection Backbone.Collection <optional>

The collection of contextual link models.

Source:

updateVisibility()

Automatically updates visibility of the view/edit mode toggle.

Source: