You are here

public static function Drupal::state in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal.php \Drupal::state()

Returns the state storage service.

Use this to store machine-generated data, local to a specific environment that does not need deploying and does not need human editing; for example, the last time cron was run. Data which needs to be edited by humans and needs to be the same across development, production, etc. environments (for example, the system maintenance message) should use \Drupal::config() instead.

Return value

\Drupal\Core\State\StateInterface

12 calls to Drupal::state()
DrupalTest::testState in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the state() method.
entity_test_entity_base_field_info_alter in core/modules/system/tests/modules/entity_test/entity_test.module
Implements hook_entity_base_field_info_alter().
entity_test_entity_type_alter in core/modules/system/tests/modules/entity_test/entity_test.module
Implements hook_entity_type_alter().
FieldConfig::preDelete in core/modules/field/src/Entity/FieldConfig.php
Acts on entities before they are deleted and before hooks are invoked.
FieldStorageConfig::preDelete in core/modules/field/src/Entity/FieldStorageConfig.php
Acts on entities before they are deleted and before hooks are invoked.

... See full list

File

core/lib/Drupal.php, line 408
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function state() {
  return static::getContainer()
    ->get('state');
}