Drupal 8  8.0.2
FormCache Class Reference
Inheritance diagram for FormCache:

Public Member Functions

 __construct ($root, KeyValueExpirableFactoryInterface $key_value_expirable_factory, ModuleHandlerInterface $module_handler, AccountInterface $current_user, CsrfTokenGenerator $csrf_token, LoggerInterface $logger, RequestStack $request_stack, RequestPolicyInterface $request_policy)
 
 getCache ($form_build_id, FormStateInterface $form_state)
 
 setCache ($form_build_id, $form, FormStateInterface $form_state)
 
 deleteCache ($form_build_id)
 

Protected Member Functions

 loadCachedFormState ($form_build_id, FormStateInterface $form_state)
 

Protected Attributes

 $keyValueExpirableFactory
 
 $csrfToken
 
 $currentUser
 
 $moduleHandler
 
 $logger
 
 $configFactory
 
 $requestStack
 
 $requestPolicy
 
 $root
 

Detailed Description

Encapsulates the caching of a form and its form state.

Constructor & Destructor Documentation

__construct (   $root,
KeyValueExpirableFactoryInterface  $key_value_expirable_factory,
ModuleHandlerInterface  $module_handler,
AccountInterface  $current_user,
CsrfTokenGenerator  $csrf_token,
LoggerInterface  $logger,
RequestStack  $request_stack,
RequestPolicyInterface  $request_policy 
)

Constructs a new FormCache.

Parameters
string$rootThe app root.
\Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface$key_value_expirable_factoryThe key value expirable factory, used to create key value expirable stores for the form cache and form state cache.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.
\Drupal\Core\Session\AccountInterface$current_userThe current user.
\Drupal\Core\Access\CsrfTokenGenerator$csrf_tokenThe CSRF token generator.
\Psr\Log\LoggerInterface$loggerA logger instance.
\Symfony\Component\HttpFoundation\RequestStack$request_stackThe request stack.
\Drupal\Core\PageCache\RequestPolicyInterface$request_policyA policy rule determining the cacheability of a request.

References Drupal\csrfToken(), Drupal\currentUser(), Drupal\logger(), Drupal\moduleHandler(), Drupal\requestStack(), and Drupal\root().

Here is the call graph for this function:

Member Function Documentation

deleteCache (   $form_build_id)

{Deletes a form in the cache.

Parameters
string$form_build_idThe unique form build ID.
}

Implements FormCacheInterface.

getCache (   $form_build_id,
FormStateInterface  $form_state 
)

{Fetches a form from the cache.

Parameters
string$form_build_idThe unique form build ID.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
}

Implements FormCacheInterface.

References Drupal\csrfToken(), Drupal\currentUser(), FormStateInterface\getBuildInfo(), FormCache\loadCachedFormState(), Crypt\randomBytesBase64(), and FormStateInterface\setBuildInfo().

Here is the call graph for this function:

loadCachedFormState (   $form_build_id,
FormStateInterface  $form_state 
)
protected

Loads the cached form state.

Parameters
string$form_build_idThe unique form build ID.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.

References FormStateInterface\getBuildInfo(), Drupal\moduleHandler(), Drupal\root(), and FormStateInterface\setFormState().

Referenced by FormCache\getCache().

Here is the call graph for this function:

Here is the caller graph for this function:

setCache (   $form_build_id,
  $form,
FormStateInterface  $form_state 
)

{Stores a form in the cache.

Parameters
string$form_build_idThe unique form build ID.
array$formThe form to cache.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
}

Implements FormCacheInterface.

References Drupal\csrfToken(), Drupal\currentUser(), FormStateInterface\getCacheableArray(), and Drupal\logger().

Here is the call graph for this function:


The documentation for this class was generated from the following file: