Adding state variables from D7 core

@see https://www.drupal.org/node/1775842