July 2017
Intermediate to advanced
456 pages
11h 32m
English
In Drupal 7 and earlier, system configuration and state were commingled in the variables table. In addition to the new Configuration API, Drupal 8 added the State API. This should be used for settings that are:
This encompasses items such as the last cron run timestamp, CSRF tokens, and so on. Typical uses include:
$val = \Drupal::state()->get('key');
\Drupal::state()->set('key', 'value');
\Drupal::state()->delete('key');
Read now
Unlock full access