Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Drupal.php

function 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

1 call to Drupal::state()
Workspace::postDelete in core/modules/workspaces/src/Entity/Workspace.php
Acts on deleted entities before the delete hook is invoked.

File

core/lib/Drupal.php, line 480

Class

Drupal
Static Service Container wrapper.

Code

public static function state() {
    return static::getContainer()->get('state');
}
RSS feed
Powered by Drupal