我的drupal页面有问题。我们使用opigno工具(它的模块允许创建课程 - 可以购买的节点)。
现在我们遇到了课程节点的问题。一切正常,直到用户购买该课程并且drupal商业状态处于“待定”状态。现在的问题是该节点除课程标题外什么也没有显示。
我开始思考最新情况,并查看了课程视图的视图设置。没有(没有设置权限,没有过滤条件......)
然后我看了一下课程视图的模板覆盖。然后我看到了...... [/ p>
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()打印出来!但为什么呢?
我在谷歌搜索了一个钩子,它能够“覆盖”渲染功能,并可能在用户处于“待定”状态时拒绝输出。但是......没什么。 我找到了这个钩子:
{hook}_node_view()
我在所有模块中搜索了这个钩子的使用但是当从模块中删除这些功能时没有改变任何东西。还有其他选项来“覆盖”render()函数吗?我可以搜索的另一个钩子?或者也许你对opigno有同样的问题?
答案 0 :(得分:0)
对不起 - 问题在于Opigno Field Access Module。我停用它,它就像一个魅力。