欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

为什么一个Drupal cache_form形式没有被缓存吗?Why would a Drupal form not be cached in cache_form?

shiping1 的头像
 此内容更新于:2015-01-03
主题:
原文:

My form, lets call it organize_issue, is a form in a custom module being called from the menu using the page callback drupal_get_form function. The form works perfectly well.

I'm trying to implement some AHAH type functionality now, and need to get the page from cache usingform_get_cache($form_build_id, $form_state) but, oddly enough, my form isn't being cached. Ever. Other forms on the site are, just not this one. As I said the form works fine, and submits and validates and whatnot... it just never caches. Is their something simple I'm missing?

解决方案
在你的函数,构建形式你应该有一个值设置形式缓存… 应该在一些事情像“#缓存”=没错,如果你没有看到它这可能是为什么表单不是缓存…你应该构建形式,数组的形式将它设置为缓存: HTH
原文:

In your function that builds the form you should have a value setting the form to cache...

Should look some thing like '#cache' => TRUE, if you don't see it that might be why your form isn't caching...you should be building your form on a way that the array of the form sets it to cache:

<?php
  function _organize_issue_form($node) {
    global $user;

 $form = array(
   '#theme' => 'organize_issue',
   '#cache' => TRUE,
 );
?>

HTH

十几天的时间开发了一款简单的Android应用(大师兄),平均每天的广告收入大约120多元,模式简单、收益尚可、 维护工作少,供广大android开发者参照,增加一些业余收入。 
下载:》》【大师兄】安装包《《

来自 http://www.28im.com/php/a1390602.html


y would a Drupal form not be cached in cache_form?

为什么一个Drupal的形式不被缓存在cache_form?

 

问题 (Question)

My form, lets call it organize_issue, is a form in a custom module being called from the menu using the page callback drupal_get_form function. The form works perfectly well.

I'm trying to implement some AHAH type functionality now, and need to get the page from cache using form_get_cache($form_build_id, $form_state) but, oddly enough, my form isn't being cached. Ever. Other forms on the site are, just not this one. As I said the form works fine, and submits and validates and whatnot... it just never caches. Is their something simple I'm missing?

我的表,我们叫它organize_issue,在自定义的模块被称为从使用页面回调菜单形式drupal_get_form功能。非常好的形式。

我试图实施某些类型的功能和效果,现在,需要把页面缓存使用form_get_cache($form_build_id, $form_state)但是,奇怪的是,我没有被缓存。曾经。网站上的其他形式的,不是这一个。正如我所说的形式,做工精细,并提出和验证和诸如此类的东西…它只是没有缓存。是他们的简单的东西我失踪?

 

最佳答案 (Best Answer)

In your function that builds the form you should have a value setting the form to cache...

Should look some thing like '#cache' => TRUE, if you don't see it that might be why your form isn't caching...you should be building your form on a way that the array of the form sets it to cache:

<?php
  function _organize_issue_form($node) {
    global $user;

 $form = array(
   '#theme' => 'organize_issue',
   '#cache' => TRUE,
 );
?>

HTH

在你的函数,建立了你应该有一个值设置窗体缓存形式…

看起来一样'#cache' => TRUE,如果你没有看到它,可能是为什么你不能缓存……你应该的方式形成阵列设置缓存建立你的形式:

<?php
  function _organize_issue_form($node) {
    global $user;

 $form = array(
   '#theme' => 'organize_issue',
   '#cache' => TRUE,
 );
?>

HTH

来自 http://www.4byte.cn/question/1275522/why-would-a-drupal-form-not-be-cached-in-cache-form.html

普通分类: