将结果与表单包含在同一页面上,并使用 drupal 对结果进行主题化
我已经在 drupal 中成功创建了一个页面,该页面在同一页面上显示表单和结果。该表单就像结果的过滤器。结果包括一堆 html,其中包括通过 Chart API 模块 (http://drupal.org/project /图表)。结果通过标记表单元素包含在表单中(从伊顿的评论中获取:Drupal:如何在与表单相同的页面上呈现表单结果)。
由于我无法访问表单 API 范围之外的表单结果(例如页面回调函数),因此我似乎无法真正对结果进行主题化。有没有办法将复杂的结果与表单放在同一页面上并使结果主题化?另外,有没有更好的drupal方式在同一页面上显示表单结果?
I have successfully created a page in drupal that displays a form and results on the same page. The form acts like a filter of the results. The results include a bunch of html that includes google charts via the Chart API module (http://drupal.org/project/chart). The results are included in the form via a markup form element (Got that from eaton's comments here: Drupal: How to Render Results of Form on Same Page as Form).
Since I can't access the form results outside of the scope of the form API (e.g. like the page callback function), I can't seem to really theme the results. Is there a way to place complex results on the same page as a form and make the results themeable? Also, is there a better drupal way to display form results on the same page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
drupal 中的任何东西都是主题化的——这是让 drupal 变得很棒的另一件事。您可以通过使用 hook_theme() 并在此处设置您想要使用的主题模板以及您希望传递给主题文件的参数来完成此操作。您可以像这样编写主题
然后,即使按照帖子中的建议,您也可以在参数可用的任何地方通过调用
theme('theme_name', $parameters);
来调用此主题Anything in drupal is themeable - which is one more thing that makes drupal awesome. You can do this by using hook_theme() and setting here either the theme template you would like to use as well as the parameters you wish to pass to the theme file. You would write the theme like so
Then even as is suggested in the post you can call this theme wherever your parameters are available by calling
theme('theme_name', $parameters);
我对你的解决方案感兴趣。我们使用视图和暴露的过滤器做了听起来非常相似的事情。对视图结果和表单进行主题化是在 drupal 中要做的非常直接/标准的事情类型。示例:views-expose-form-form_name.tpl.php 和views-view-view_name.tpl.php。表单也可更改,查看hook_form_alter。
I'd be interested in your solution for this. We did very similar sounding things using Views and Exposed Filters. Theming both the results of the view and the form were very straight forward/standard types of things to do in drupal. Example: views-exposed-form-form_name.tpl.php and views-view-view_name.tpl.php. The form is also changeable view the hook_form_alter.