Drupal:更改视图参数
我广泛搜索以找到解决此问题的可行解决方案,但找不到。
我想要做的是更改传递给视图的参数,因为我希望将 pathauto
清理后的分类术语用作参数。我有一段代码可以将清理后的术语转换回原始术语,但无法使视图使用它。
我看到有些人在 hook_preprocess_views_view(&$vars)
中更改了它,但就我而言(Views 2.11)在 $vars
中有一个参数实例化了很多次,以至于它不是方式。
谁能帮我改变这个论点吗?
I searched far and wide to find a working solution to this but couldn't find it.
What I want to do is change the argument that is passed to the view because I want for pathauto
cleaned taxonomy terms to work as an argument. I have a code that transforms cleaned term back to a original one, but cannot make the view use it.
I saw some people changing it in hook_preprocess_views_view(&$vars)
but in my case (Views 2.11) has a argument in $vars
instanced so many times that it's not the way.
Can anyone please help me change this argument?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能有更好的方法,但您可以使用views_embed_view()并自己设置参数
There may be a better way but you could use views_embed_view() and set the arguments yourself
我有两个想法,要么向视图参数的 phpcode 部分添加一些自定义 php 代码来执行类似的操作
,要么尝试使用未测试它们的函数
,因此不知道哪个会起作用。
I have two ideas, either to add some custom php code to the view's argument's phpcode section that does something like this
or try to use the function
didn't test them so don't know which will work.
我认为
hook_views_pre_view
可能会帮助你做到这一点。I think
hook_views_pre_view
might help you do just that.