Pre-generating drupal forms
Theoretically we can pre-genrate drupal form output and cache it which then will be served instead of regenrating form html on every form view.
Few issues:
1) CSRF tokens make form caching useless.
2) Form action in HTML makes cross-page caching useless because on each page form action is set to be that page's URL.
Possible solutions:
1) Cache based on session_id, which is what the form token is based on
2) We can perform string replacement on the cached form output to correct form action.
3) Do NOT inject CSRF protection into search form. Search form redirects to a GET page therefore performing CSRF check on it is a waste of resource.
Most user facing forms are fetched using drupal_get_form(), more so forms are rendered using drupal_render_form().
To make the above work we need to change drupal_render_form to store rendered HTML in cache and change drupal_get_form() to first attempt to load form HTML from cache and serve that if cache exist.
- 1906 reads
