By admin , 1 April, 2023 Inject States to FormBase use Drupal\Core\State\StateInterface; /** * The state store. * * @var \Drupal\Core\State\StateInterface */ protected $state; /** * Drush command constructor. * * @param \Drupal\Core\State\StateInterface $state * T Tags states dependency injection
By admin , 1 April, 2023 Save custom data to States Reading StateA single value.$val = \Drupal::state()->get('key');Multiple key/value pairs.$pairs = \Drupal::state()->getMultiple($keys);Writing StateA single value.\Drupal::state()->set('key','value');Multiple values. Tags states