function 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 config() instead.

Return value

Drupal\Core\KeyValueStore\KeyValueStoreInterface

1 string reference to 'state'
AliasManager::__construct in drupal/core/lib/Drupal/Core/Path/AliasManager.php

File

drupal/core/includes/bootstrap.inc, line 2474
Functions that need to be loaded on every Drupal request.

Code

function state() {
  return drupal_container()
    ->get('keyvalue')
    ->get('state');
}