Class: StateModel

Drupal.contextual.StateModel()

new StateModel()

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

Source:

Extends

  • Backbone.Model

Members

defaults :object

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

hasFocus :bool

Represents if the contextual trigger or options have focus.

Type:
  • bool
Source:

isLocked :bool

When the model is locked, the trigger remains active.

Type:
  • bool
Source:

isOpen :bool

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

Type:
  • bool
Source:

regionIsHovered :bool

Represents if the contextual region is being hovered.

Type:
  • bool
Source:

title :string

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

Type:
  • string
Source:

Methods

blur() → {Drupal.contextual.StateModel}

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

Source:
Returns:

The current contextual state model.

Type
Drupal.contextual.StateModel

close() → {Drupal.contextual.StateModel}

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.

Source:
Returns:

The current contextual state model.

Type
Drupal.contextual.StateModel

focus() → {Drupal.contextual.StateModel}

Gives focus to this contextual link.

Also closes + removes focus from every other contextual link.

Source:
Returns:

The current contextual state model.

Type
Drupal.contextual.StateModel

toggleOpen() → {Drupal.contextual.StateModel}

Opens or closes the contextual link.

If it is opened, then also give focus.

Source:
Returns:

The current contextual state model.

Type
Drupal.contextual.StateModel