覆盖 drupal 日历主题

发布于 2024-09-24 03:55:46 字数 107 浏览 2 评论 0原文

我正在尝试为日历视图设置主题,有没有办法用模块覆盖主题路径而不是覆盖模板文件?

我想创建一个覆盖主题功能的模块,以便我可以在模块中包含模板文件而不是日历模块。

提前谢谢

I am trying to theme a calendar view, is there a way to override the theming path with a module instead of overwriting the template files?

I want to create a module that overrides the theming functions so I can include the template files in my module instead of the calendar module.

thx in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

你不是我要的菜∠ 2024-10-01 03:55:46

您可以覆盖模块中的视图模板,请参阅 在模块中使用默认视图视图高级帮助页面。由于日历是一个视图插件,我认为视图模板的基本行为适用。如果在 hook_theme($existing, $type, $ theme, $path) 不适用于日历视图,您可能需要使用 hook_theme_registry_alter(&$ite​​ms)

You can override views template in a module, see the "Theming your views in your module" in the Using default views in your module page of Views' Advanced Help. Since Calendar is a views plugin, I think the basic behaviors of Views templating applies. If declaring your own themeable output in your hook_theme($existing, $type, $theme, $path) doesn't work for a Calendar view, you may need to use hook_theme_registry_alter(&$items).

何处潇湘 2024-10-01 03:55:46

我认为你不能在模块中做类似的事情,至少不能以干净的方式做。

Drupal 将功能(模块)和表示(主题)分开。将两者分开是很有意义的。

  • 更干净、更易于维护的代码。
  • 不同站点之间的功能需求是共同的。
  • 演示和功能通常由不同的人(开发人员和主题人员)完成,

因此如果您可以在模块中执行类似的操作,我不会感到惊讶。但你会在 Drupal 的支持下工作,并且很难做到这一点,而且没有充分的理由。

如果您想创建可重用的样式、模板覆盖等,请改用子主题系统。

I don't think you can do something like that in a module, at least not in a clean way.

Drupal have functionality (modules) and presentation (themes) separated. It makes good sense to divide the two.

  • Cleaner more maintainable code.
  • Functionality needs is common among different sites.
  • Presentation and functionality is often done by different people (developers and themers)

So I wouldn't be surprised if you could do something like this in a module. But you would be working against Drupal, have a hard time doing it, and with no good reason.

If you want to create reusable styles, template overrides etc, use the sub theme system instead.

怀念你的温柔 2024-10-01 03:55:46

看来您在这里要做的是重写calendar模块的功能,在主题层有机会干预它之前完全取代正常的日历行为。

在这些(希望很少见)情况下,最好的办法是创建您自己的 calendar 分支作为新模块,并以现有 calendar 代码作为起点。直接修改模块代码比尝试破解 Drupal 的基本功能/显示交互要容易得多。

我通常不会推荐这样做,但它似乎适合您的情况。

请务必将任何改进发送回日历开发人员,以便我们都能受益:)

It seems like what you're looking to do here is rewrite how the calendar module functions, in a way that completely replaces normal calendar behavior before the theme layer has a chance to meddle with it.

In these (hopefully rare) cases, the best thing to do is create your own fork of calendar as a new module, with the existing calendar code as a starting point. Modifying the module code directly will be much easier than trying to hack Drupal's basic functionality/display interactions.

I normally wouldn't recommend this, but it seems appropriate in your case.

Be sure to send any improvements back to the calendar devs so that we all can benefit :)

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