Skip to content

ECA state: write

Plugin ID: eca_state_write

Available since: 1.1.0

Writes a value into ECA's own persistent key value store by the given key. This is not Drupal's state service; use Key value store: write with the collection "state" to write there.

This writes to ECA's own store, not Drupal's state service

This action writes into the eca key value collection, which belongs to ECA alone. It does not write the state that \Drupal::state() exposes and that drush state:get reads. 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 written here is therefore invisible to drush state:get my_key and to any module that reads core state, and a value placed with drush state:set my_key my_value is invisible to ECA state: read. Nothing reports an error when this happens.

To publish a value where Drush, Drupal core, or another module can read it, use Key value store: write 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

The value of the state — config key: value

The value that gets stored under the given key.
This field supports tokens.

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

Interpret above config value as YAML format — config key: use_yaml

Nested data can be set using YAML format, for example mykey: myvalue. When using this format, this option needs to be enabled. When using tokens and YAML altogether, make sure that tokens are wrapped as a string. Example: title: "[node:title]"

Type: checkbox · Required: no · Default: false

Validate YAML to prevent this from being executed when invalid — config key: validate_yaml

Type: checkbox · Required: no · Default: false