Class: StateModel

Drupal.contextual. StateModel

new Drupal.contextual.StateModel()

Models the state of a contextual link's trigger, list & region.

Extends

  • Backbone.Model

Members

defaultsobject

Properties:
Name Type Description
title string
regionIsHovered bool
hasFocus bool
isOpen bool
isLocked bool

hasFocusbool

Represents if the contextual trigger or options have focus.

isLockedbool

When the model is locked, the trigger remains active.

isOpenbool

Represents if the contextual options for an entity are available to be selected (i.e. whether the list of options is visible).

regionIsHoveredbool

Represents if the contextual region is being hovered.

titlestring

The title of the entity to which these contextual links apply.

Methods

Removes focus from this contextual link, unless it is open.

Returns:
Type Description
Drupal.contextual.StateModel The current contextual state model.

Closes this contextual link.

Does not call blur() because we want to allow a contextual link to have focus, yet be closed for example when hovering.

Returns:
Type Description
Drupal.contextual.StateModel The current contextual state model.

Gives focus to this contextual link.

Also closes + removes focus from every other contextual link.

Returns:
Type Description
Drupal.contextual.StateModel The current contextual state model.

Opens or closes the contextual link.

If it is opened, then also give focus.

Returns:
Type Description
Drupal.contextual.StateModel The current contextual state model.