Skip to content

ECA state: read

Plugin ID: eca_state_read

Available since: 1.1.0

Reads a value from ECA's own persistent key value store by the given key. The result is stored in a token. This is not Drupal's state service; use Key value store: read with the collection "state" to read that.

This reads ECA's own store, not Drupal's state service

This action reads the eca key value collection, which belongs to ECA alone. It does not read the state that \Drupal::state() exposes and that drush state:set writes to. ECA's EcaState service extends Drupal's state service but replaces the store behind it, so the two never see each other's values.

A value placed with drush state:set my_key my_value is therefore invisible to this action, and a value written by ECA state: write is invisible to drush state:get my_key. Nothing reports an error when this happens. The action simply returns an empty value, which usually surfaces later as a condition that never matches.

To read a value that Drush, Drupal core, or another module placed in the real state, use Key value store: read with its collection set to state.

The ECA state plugins date from ECA 1.0.0 and 1.1.0, when they were still called "Persistent state". The general key value store plugins, which can reach Drupal's state, arrived later in 2.0.0. ECA 3.1.x renamed the older plugins to "ECA state", and that rename is what resolved the ambiguity, because the label now names the store the plugins actually use. The plugin IDs did not change, so existing models keep working.

Fields

State key — config key: key

The key of the value in ECA's key value store.
This field supports tokens.

Type: textfield · Required: no · Default: empty string

Name of token — config key: token_name

The name of the token, the value is stored into. Please provide the token name only, without brackets.

Type: textfield · Required: no · Default: empty string