Drupal:如何使用上下文来触发由视图引起的分类术语条件的反应?

发布于 2024-09-02 16:00:13 字数 240 浏览 9 评论 0原文

我想做的是使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声无音无过去 2024-09-09 16:00:13

这里值得的是我的两分钱:
在使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文