【问题标题】:Drupal hook before or after render() function在 render() 函数之前或之后的 Drupal 钩子
【发布时间】:2014-09-27 23:41:12
【问题描述】:

我的 drupal 页面有问题。我们使用 opigno 工具(它是一个允许创建课程的模块 - 可以购买的节点)。

现在我们遇到了课程节点视图的问题。一切正常,直到用户购买了课程并且 drupal 商务状态为“待定”。现在的问题是该节点除了课程名称外什么都没有显示。

我开始思考发生了什么,并查看了课程视图的视图设置。什么都没有(没有设置权限,没有过滤条件......)

然后我看了一下课程视图的模板覆盖。然后我就看到了……

print render($content['body']);

啊!渲染视图内容的渲染函数。于是我问自己:内容是什么?

打印出 $content 变量后,我看到了这个:

Array
(
[body] => Array
        (
            [#theme] => field
            [#weight] => 1
            [#title] => Description
            [#access] => 
            [#label_display] => hidden
            [#view_mode] => full
            [#language] => und
            [#field_name] => body
            [#field_type] => text_with_summary
            [#field_translatable] => 0
            [#entity_type] => node
            [#bundle] => course
            [#object] => stdClass Object
                (
                    [vid] => 185
                    [uid] => 60
                    [title] => Demo Course
                    [log] => 
                    [status] => 1
                    [comment] => 1
                    [promote] => 0
                    [sticky] => 0
                    [vuuid] => 16e7999b-28bb-4f3e-8bed-54a21b17f398
                    [nid] => 176
                    [type] => course
                    [language] => und
                    [created] => 1406897520
                    [changed] => 1407145285
                    [tnid] => 0
                    [translate] => 0
                    [uuid] => 22baf19a-dc32-4137-b698-89f1bb4adc59
                    [revision_timestamp] => 1407145285
                    [revision_uid] => 1
                    [body] => Array
                        (
                            [und] => Array
                                (
                                    [0] => Array
                                        (
                                            [value] => 

This is a sample course for beta testers, it will show you the structure of the courses.

Here usually is displayed the description of the course.

Please "enroll" if you want to see the contents of this demo course. 

                                            [summary] => This is a sample course for beta testers to help you see the structure of a course. Please have a look on it!
                                            [format] => html
                                            [safe_value] => 

This is a sample course for beta testers, it will show you the structure of the courses.

Here usually is displayed the description of the course.

Please "enroll" if you want to see the contents of this demo course. 

                                            [safe_summary] => This is a sample course for beta testers to help you see the structure of a course. Please have a look on it!
                                        )

                                )

                        )
)

啊啊!所以 $content 有内容,但它没有用 render() 打印出来!但为什么呢?

我在 google 中搜索了一个能够“覆盖”渲染函数并在用户处于“待处理”状态时拒绝输出的钩子。但是……什么都没有。 我找到了这个钩子:

{hook}_node_view()

我在所有模块中搜索了这个钩子的使用,但是当从模块中删除这些函数时并没有改变任何东西。还有其他选项可以“覆盖” render() 函数吗?我可以搜索的另一个钩子?或者也许你对 opigno 也有同样的问题?

【问题讨论】:

    标签: drupal drupal-7 views


    【解决方案1】:

    很抱歉 - 问题出在 Opigno 字段访问模块。我停用了它,它就像一个魅力。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-21
      • 2012-08-22
      相关资源
      最近更新 更多