Skip to content

Key value store: write

Plugin ID: eca_keyvaluestore_write

Available since: 2.0.0

Write a value to the Drupal key value store by the given key.

This is the action that can write Drupal's state

Set the collection to state to write into Drupal's own state, the store that \Drupal::state() exposes and that drush state:get reads. This is the supported way to publish a value where Drush, Drupal core, or another module can pick it up.

The ECA state plugins do not reach that store. As their name says, they use the eca collection, which belongs to ECA alone. Set the collection here to eca to write values those plugins can read.

Fields

Collection — config key: collection

The collection of the store.
This field supports tokens.

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

Store key — config key: key

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

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

Value — config key: value

The value to store.

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

Interpret above value as YAML format — config key: use_yaml

Nested data can be set using YAML format, for example mykey: "My value". 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

Only if new — config key: ifnotexists

If enabled, this only stores the value if the key does not exist yet.

Type: checkbox · Required: no · Default: false