简体   繁体   English

Drupal中的模块开发教程

[英]Module development tutorial in Drupal

I'd like to learn how to create modules in drupal- modules which can interact with the user, database, assign permissions, views. 我想学习如何在drupal- modules中创建模块,这些模块可以与用户,数据库,分配权限,视图进行交互。

Is there any good video tutorial or a simple sample module which covers these things? 是否有任何好的视频教程或简单的示例模块涵盖这些内容?

Thanks. 谢谢。

My suggestion would be to pick up a copy of Pro Drupal Development and start working your way through. 我的建议是拿起Pro Drupal Development的副本并开始努力。 I think that book is the best one stop option for providing an easy to follow, yet in depth start for learning Drupal development. 我认为这本书是最好的一站式选项,为学习Drupal开发提供了一个易于理解和深入的开始。

If you really wanted to get by without purchasing a book, I would suggest checking out the Lullabot site for whatever free content they have available. 如果你真的想在不购买书籍的情况下过关 ,我建议您查看Lullabot网站,了解他们提供的任何免费内容。

After an initial background, the Drupal api pages should be helpful for you, . 在初步背景之后, Drupal api页面应该对您有所帮助。 Hit the search box in the upper left hand corner for type ahead search to find detailed info on drupal functions. 点击左上角的搜索框进行类型提前搜索,找到有关drupal函数的详细信息。 This would be a great resource for getting some more background on the functions googletorp listed. 这将是一个很好的资源,可以获得更多关于googletorp列出的函数的背景信息。 I agree with googletorp that those are a good list of functions to get started with. 我同意googletorp的说法,这些是开始使用的功能列表。

It requires some effort to learn how to develop in Drupal. 需要一些努力来学习如何在Drupal中进行开发。 You might be able to find some good videos, but you will only really master this when you get your hands dirty and start coding. 你可能能够找到一些好的视频,但只有当你弄脏并开始编码时,你才会真正掌握这一点。

How hard this will be for you, is also highly dependent on your background. 这对你来说有多难,也高度依赖于你的背景。 A seasoned PHP developer wont find it that difficult to develop with Drupal. 经验丰富的PHP开发人员不会发现使用Drupal很难开发。

There are some key points that you need to understand though. 但是,您需要了解一些关键点。

  • The hook system. 钩系统。 This is Drupal's way to do OOP. 这是Drupal做OOP的方法。 The idea is that modules or Drupal core can define and run hooks when an event happen that other modules want to react to. 这个想法是模块或Drupal核心可以在其他模块想要响应的事件发生时定义和运行钩子。 An example could be the creation of a user or the display of a node. 一个示例可以是用户的创建或节点的显示。 To implement a hook, you simply create a function with the correct name. 要实现一个钩子,只需创建一个具有正确名称的函数。 You need replace the "hook" in the name of the hook with your module name. 您需要使用模块名称替换钩子名称中的“钩子”。
  • Drupal has a lot of API functions and it takes time to find them and learn how to use them. Drupal有很多API函数,找到它们并学习如何使用它们需要时间。 Take your time, as using the right API functions can make a big difference. 花点时间,因为使用正确的API函数可以产生很大的不同。 Drupal has a nice API site Drupal有一个很好的API站点

From your description you should take a look at these functions: 根据您的描述,您应该看看这些功能:

  • hook_user hook_user
  • hook_perms hook_perms
  • hook_menu hook_menu
  • db_query db_query

In addition to what googletorp and mike munroe already said, check out the module developers guide on drupal.org. 除了googletorp和mike munroe已经说过的内容之外,请查看drupal.org上的模块开发人员指南 On the api site, check out the well documented example modules . 在api站点上,查看记录良好的示例模块

I have learnt drupal from beginner to advanced with CodeKarate. 我从CodeKarate学习了从初学者到高级的drupal。 its one of the best website for drupal. 它是drupal最好的网站之一。

http://www.codekarate.com

There is a very good, easy to follow tutorial on developing JQuery/Javascript modules on Drupal . 有关在Drupal开发JQuery / Javascript模块的非常好的,易于学习的教程。 Check it out as well. 检查一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM