Drupal:如何使用上下文来触发由视图引起的分类术语条件的反应?
我想做的是使用 Context 模块根据分类术语条件插入我选择的 $body_classes 。好吧,这就是 Context 模块的用途。如果您的内容/页面源是涉及适当条款的节点,则看起来很简单。但是,我有一个由视图生成的页面,该页面具有适当的分类术语 id,应该触发条件,但事实并非如此。
现在我可以在 template.php 的“预处理”中设置我的 $body_classes 但我宁愿避免这样做。这在上下文中甚至可能吗?或者我只是做错了什么?
What I would like to do is use the Context module to insert $body_classes of my choosing based on a Taxonomy Term condition. Fine, that's what the Context module is for. Seems simple enough IF your content/page source is a node that is involved with the appropriate Terms. However, I have a page generated by Views that has the appropriate Taxonomy Term id that SHOULD trigger the condition but it doesn't.
Now I could set my $body_classes in a "preprocess" in template.php but I'd rather avoid that. Is this even possible in Context? Or am I just doing something wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里值得的是我的两分钱:
在使用 drupal 模块时,我发现当我知道一个模块(或模块组合)几乎可以满足我的需要,并且我尝试将它们推向极限时,我发现自己浪费了更多的时间来尝试制作模块执行“x”功能,而不是编写我自己的简单小模块。
因此,对于“边缘情况”,当看起来明显需要非常复杂的设置/配置来实现某些目标时(如果您可以使用手中的 mod 来实现它,只需去编写您自己的小自定义模块即可。
For what it is worth here is my two cent :
When working with drupal modules, I have found that when i know a module (or combination of modules) is almost doing what i need, and i try and push them to the limit, i find myself wasting far more time trying to make the modules do that "x" feature, than it would take to code my own simple little module.
So for "edge cases", when it looks abvious that you need a very complexe setup/config to achieve something (if you ever can achieve it with the mods in hand, just go and code your own little custom module.