18.10.2016 Views

Drupal 7 Module Development

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5<br />

That's it! The text returned from token_replace() will now look something<br />

like this:<br />

Hello eshqi,<br />

We have been notified that you have posted comments on The Coolest<br />

Site In The World that are in violation of our terms of service. If<br />

this behavior continues your account will be suspended.<br />

Sincerely,<br />

The Coolest Site In The World<br />

This e-mail is much better and personalized for both the sender and the recipient.<br />

Summary<br />

In reality the User Warn module is probably of limited utility, but it does help to<br />

introduce many of the core concepts that <strong>Drupal</strong> developers will use on a day-to-day<br />

basis. You are now able to create pages at a specific URL using hook_menu(), and<br />

implement forms on those pages using the Form API. The values submitted from this<br />

form can be saved using functions like system_settings_form(), confirm_form(),<br />

or your own custom submit handler. You can also send the results of a form<br />

submission as a custom email using dynamic tokens for text replacement.<br />

In Chapter 7, Creating New Fields, we will begin examining <strong>Drupal</strong> 7's new Field API,<br />

the core implementation of what was formerly the CCK module.<br />

[ 149 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!