Drupal 7 自定义主题块配置
我想创建一个自定义主题,并允许管理员为页面上的每个块(在每个块的配置页面中)选择块的呈现方式(将有 2 种或更多类型的选项)以及也是用于渲染块外观的颜色主题。
我不想一次性配置所有块,而是特别配置每个块。例如:在一个页面上,我将有 1 个块显示为 (type1, color1),1 个块显示为 (type1, color2),1 个块显示为 type2。
您建议我如何实施这个? 我应该使用 hook_block_configure 和 hook_block_save 吗?另外,我应该将此信息保存在 block_save 中的哪里,因为它是块实例特定的信息,我应该在数据库中创建另一个表还是可以将其保存在现有块表中的任何位置?
我应该直接在主题中包含此配置还是创建包含此功能的自定义模块?
I would like to create a custom theme and allow the administrator to select for each block on the page (in each block's configuration page) the way in which the block will be rendered (there will be 2 or more types of options for these) and also a color theme to use for rendering the look of the block.
I don't want the configure all the block at one, but each block in particular. Eg: on a page I will have 1 block displayed with (type1, color1), 1 with (type1, color2) and 1 with type2.
How would you suggest I implement this?
Should I use hook_block_configure and hook_block_save? And also where should I save this information in block_save as it is block instance specific information, should I create another table in the DB or can I save it anywhere within the existing block tables?
Should I include this configuration in the theme directly or create a custom module that includes this functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想查看 http://drupal.org/project/skinr,它已经提供了样式选项每个块。
You want to look at http://drupal.org/project/skinr, which already provides styling options for each block.