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
|
Extends
- Backbone.Model
Members
contextualCount :number
Tracks how many contextual links exist on the page.
Type:
- number
defaults :object
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
isViewing |
bool | |
isVisible |
bool | |
contextualCount |
number | |
tabbingContext |
Drupal~TabbingContext |
isViewing :bool
Indicates whether the toggle is currently in "view" or "edit" mode.
Type:
- bool
isVisible :bool
Indicates whether the toggle should be visible or hidden. Automatically calculated, depends on contextualCount.
Type:
- bool
(nullable) tabbingContext :Drupal~TabbingContext
A TabbingContext object as returned by Drupal~TabbingManager
:
the set of tabbable elements when edit mode is enabled.
Type:
Methods
countContextualLinks(contextualModel, contextualCollection)
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. |
lockNewContextualLinks(contextualModel, contextualCollectionopt)
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. |
updateVisibility()
Automatically updates visibility of the view/edit mode toggle.