ECA state: compare¶
Plugin ID: eca_state
Available since: 1.0.0
Compares a value from ECA's own persistent key value store against a given value. This is not Drupal's state service; use Key value store: read with the collection "state" to reach that.
This compares against ECA's own store, not Drupal's state service
This condition 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.
The condition therefore compares against values written by ECA state: write, not against anything Drush or another module placed in core state. A key that exists in core state but not in ECA's store reads as empty here, and the comparison quietly returns FALSE rather than reporting that the key was missing.
To compare a value held in the real state, load it first with
Key value store: read
using the collection state, then compare the resulting token with
Compare two scalar values.
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¶
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 Value— config key:value-
The value to compare the stored value with.
This field supports tokens.Type:
textarea· Required: no · Default: empty string Comparison operator— config key:operator-
The available comparison operators like equals or less than.
When using the "Defined by token" option, make sure there is a token with this name: eca_state_operatorType:
select· Required: no · Default:equalAllowed values:
equal,beginswith,endswith,contains,greaterthan,lessthan,atmost,atleast,_eca_token,''Comparison operator. Possible values:
- equal
- greater than
- less than
- starts with
- ends with
- contains
- at least
- at most
Comparison type— config key:type-
The type of the comparison.
When using the "Defined by token" option, make sure there is a token with this name: eca_state_typeType:
select· Required: no · Default:valueAllowed values:
value,natural,numeric,lexical,count,_eca_token,'' Case sensitive comparison— config key:case-
Compare the values based on case sensitivity.
Type:
checkbox· Required: no · Default:false Negate the condition— config key:negate-
Negates the condition. Makes TRUE to FALSE and vice versa.
Type:
checkbox· Required: no · Default:false