• <i id='PyBRq'><tr id='PyBRq'><dt id='PyBRq'><q id='PyBRq'><span id='PyBRq'><b id='PyBRq'><form id='PyBRq'><ins id='PyBRq'></ins><ul id='PyBRq'></ul><sub id='PyBRq'></sub></form><legend id='PyBRq'></legend><bdo id='PyBRq'><pre id='PyBRq'><center id='PyBRq'></center></pre></bdo></b><th id='PyBRq'></th></span></q></dt></tr></i><div id='PyBRq'><tfoot id='PyBRq'></tfoot><dl id='PyBRq'><fieldset id='PyBRq'></fieldset></dl></div>
    1. <legend id='PyBRq'><style id='PyBRq'><dir id='PyBRq'><q id='PyBRq'></q></dir></style></legend>

      <small id='PyBRq'></small><noframes id='PyBRq'>

        <bdo id='PyBRq'></bdo><ul id='PyBRq'></ul>
      <tfoot id='PyBRq'></tfoot>

        Drupal 7 hook_node_view 添加表单到节点的内容

        Drupal 7 hook_node_view add a form to the content of a node(Drupal 7 hook_node_view 添加表单到节点的内容)

        1. <tfoot id='MzjPu'></tfoot>
            <tbody id='MzjPu'></tbody>

          • <legend id='MzjPu'><style id='MzjPu'><dir id='MzjPu'><q id='MzjPu'></q></dir></style></legend>

            <small id='MzjPu'></small><noframes id='MzjPu'>

              <bdo id='MzjPu'></bdo><ul id='MzjPu'></ul>

                <i id='MzjPu'><tr id='MzjPu'><dt id='MzjPu'><q id='MzjPu'><span id='MzjPu'><b id='MzjPu'><form id='MzjPu'><ins id='MzjPu'></ins><ul id='MzjPu'></ul><sub id='MzjPu'></sub></form><legend id='MzjPu'></legend><bdo id='MzjPu'><pre id='MzjPu'><center id='MzjPu'></center></pre></bdo></b><th id='MzjPu'></th></span></q></dt></tr></i><div id='MzjPu'><tfoot id='MzjPu'></tfoot><dl id='MzjPu'><fieldset id='MzjPu'></fieldset></dl></div>

                  本文介绍了Drupal 7 hook_node_view 添加表单到节点的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  function example_module_node_view($node, $view_mode, $langcode)
                  {   
                      $f =  drupal_get_form('example_module_form', $node);
                      $node->content['data_collection_form'] = array('#value' => $f, '#weight' => 1); 
                  }
                  

                  为什么表单不显示?难道我做错了什么?正在填充表单对象.我可以做 #markup => 'Something' 并且它有效.

                  Why doesn't the form display? Am I doing something wrong? The form object is being populated. I can do #markup => 'Something' and it works.

                  推荐答案

                  drupal_get_form 的返回实际上是一个渲染数组本身,所以你可以这样做:

                  The return from drupal_get_form is actually a render array itself so you could just do this:

                  $f = drupal_get_form('example_module_form', $node);
                  $f['#weight'] = 1;
                  $node->content['data_collection_form'] = $f;
                  

                  如果你确实想用另一种方式来做,尽管表单应该是一个可渲染的元素",所以键不应该以 # 为前缀:

                  If you do want to do it the other way though the form should be a renderable 'element', so the key shouldn't be prefixed by #:

                  $f = drupal_get_form('example_module_form', $node);
                  $node->content['data_collection_form'] = array(0 => $f, '#weight' => 1);
                  

                  渲染数组中的所有条目的键以 # 为前缀都被视为属性,而那些不是的被视为子级"并递归渲染.

                  All entries in a render array with a key prefixed with # are considered properties, while those that aren't are considered 'children' and are recursively rendered.

                  这篇关于Drupal 7 hook_node_view 添加表单到节点的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='93gXs'></tbody>

                  <i id='93gXs'><tr id='93gXs'><dt id='93gXs'><q id='93gXs'><span id='93gXs'><b id='93gXs'><form id='93gXs'><ins id='93gXs'></ins><ul id='93gXs'></ul><sub id='93gXs'></sub></form><legend id='93gXs'></legend><bdo id='93gXs'><pre id='93gXs'><center id='93gXs'></center></pre></bdo></b><th id='93gXs'></th></span></q></dt></tr></i><div id='93gXs'><tfoot id='93gXs'></tfoot><dl id='93gXs'><fieldset id='93gXs'></fieldset></dl></div>
                  • <tfoot id='93gXs'></tfoot>
                        <bdo id='93gXs'></bdo><ul id='93gXs'></ul>

                        <small id='93gXs'></small><noframes id='93gXs'>

                          1. <legend id='93gXs'><style id='93gXs'><dir id='93gXs'><q id='93gXs'></q></dir></style></legend>