开发者

Overwrite drupal calendar theming

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.

开发者_JAVA技巧thx in advance


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).


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.


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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜