Drupal 7 中的多步注册表单,使用 ajax 将视频作为一个步骤 [英] Multi step registration form in Drupal 7 with video as a step using ajax

查看:32
本文介绍了Drupal 7 中的多步注册表单,使用 ajax 将视频作为一个步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Drupal 还很陌生,但我已经用 PHP 开发了大约 8 年了.我曾尝试使用管理 UI 模块执行此操作,但几乎遇到了砖墙!

I'm pretty new to Drupal but I've been developing in PHP for about 8 years now. I've tried doing this using the admin UI modules but pretty much running up against a brick wall!

  1. 我想制作一个登陆页面,即 example.com/username(匿名用户从提供的文献中获得这个).

  1. I want to make a landing page ie example.com/username (Anonymous user gets this from supplied literature).

用户在第 1 步填写详细信息

User fills out their details on step 1

用户在第 2 步留下反馈

User leaves feedback on step 2

用户在点击下一步按钮之前观看了第 3 步的短视频

User watches a short video on step 3 before being able to click Next button

用户在第 4 步中填写另一个字段并点击完成

User fills out another field in step 4 and clicks finish

这一切都完成后,我希望用户在 Drupal 站点上注册(这样他们就不必再次执行第 1 步).我知道我必须为此编写一个模块,但在这里询问是否有人知道在我开始编写代码之前可以使用 Drupal 7.

When this is all done, I want the user to be then registered with the Drupal site (so they don't have to do step 1 again). I know I would have to write a module for this but asking here to see if anyone knows it's possible to do with Drupal 7 before I get into the code.

提前致谢!:)

推荐答案

我碰巧遇到了这个在 Drupal.org 上发帖,其中有人经历了将 Drupal 7 注册表转换为多步骤注册表的整个过程,所以这将是一个很好的起点(他们甚至发布了很多代码你需要).

By a stroke of luck I just came across this post on Drupal.org in which someone has gone through the whole process of converting the Drupal 7 registration form into a multistep one, so this would be a great place to start (they've even posted a lot of the code you'll need).

基本原理是在你的模块中实现hook_form_user_register_form_alter,将表单转化为多步表单.然后,您的步骤之一是显示视频并实现您在评论中提到的 jQuery.我不会详细介绍,因为它只会反刍上面链接中的内容,但还要查看 Form API 文档,这样做会有所帮助.

The basic principle is to implement hook_form_user_register_form_alter in your module and convert the form into a multistep one. One of your steps would then be to show the video and implement the jQuery as you've mentioned in your comment. I won't go into any more detail as it would just be regurgitating what's in the link above, but also check out the Form API documentation, it'll help when doing this.

顺便说一下,如果您不熟悉 Drupal 编码,请获取示例模块,它是非常宝贵的资源.

By the way if you're new to coding in Drupal grab the Examples module, it's a very valuable resource.

希望有帮助

这篇关于Drupal 7 中的多步注册表单,使用 ajax 将视频作为一个步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆