Drupal. Какая форма!
Какая динамика!
Крайнюк Михаил
<form method="POST" name="login" action="http://site/log">
<div> Email </div>
<div> <input type="text" name="email"> </div...
Email
MOYAPOCHTA@EXAMPLE.COM

Пароль
OOOOOO
Submit
Проверка данных
Если есть ошибки
Иначе обработка
данных
function name_my_form($form, &$form_state) {
$form[‘email'] = array(
'#type' => ‘textfield',
'#title' => t(‘Email'),
);
$f...
Email
Пароль
Submit
function name_my_form_validate($form, &$form_state) {
$values = &$form_state[‘values’];
$email = $values[‘email’];
$passwo...
function mymodule_name_my_form_alter(&$form, &$form_state) {

$form['submit']['#value‘] = t(‘Войти');
}

Email

Пароль
Вой...
‘#states’ => array(
‘visible’ => ...
),
‘#ajax’ => array(
‘callback’ => ‘my_callback’,
‘wrapper’ => ‘id-of-my-wrapper’,
‘m...
Спасибо за внимание!
Drupal. Forms
Drupal. Forms
Drupal. Forms
Drupal. Forms
Drupal. Forms
Drupal. Forms
Drupal. Forms
Drupal. Forms
Drupal. Forms
Upcoming SlideShare
Loading in...5
×

Drupal. Forms

113

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
113
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Drupal. Forms

  1. 1. Drupal. Какая форма! Какая динамика! Крайнюк Михаил
  2. 2. <form method="POST" name="login" action="http://site/log"> <div> Email </div> <div> <input type="text" name="email"> </div> <div> Пароль </div> <div> <input type="password" name="pass"> </div> <input type="submit" class="submit"> </form>
  3. 3. Email MOYAPOCHTA@EXAMPLE.COM Пароль OOOOOO Submit
  4. 4. Проверка данных Если есть ошибки Иначе обработка данных
  5. 5. function name_my_form($form, &$form_state) { $form[‘email'] = array( '#type' => ‘textfield', '#title' => t(‘Email'), ); $form[‘password'] = array( '#type' => ‘password', '#title' => t(‘Пароль'), ); $form['submit'] = array( '#type' => 'submit', '#value' => t(‘Submit'), ); return $form; }
  6. 6. Email Пароль Submit
  7. 7. function name_my_form_validate($form, &$form_state) { $values = &$form_state[‘values’]; $email = $values[‘email’]; $password = $values[‘password’]; ... (проверка почты и пароля) ... if ($error) { form_error($form[‘email’], t(‘Некорректная почта!’)); } } function name_my_form_submit($form, $form_state) { ... (обработка данных) ... }
  8. 8. function mymodule_name_my_form_alter(&$form, &$form_state) { $form['submit']['#value‘] = t(‘Войти'); } Email Пароль Войти
  9. 9. ‘#states’ => array( ‘visible’ => ... ), ‘#ajax’ => array( ‘callback’ => ‘my_callback’, ‘wrapper’ => ‘id-of-my-wrapper’, ‘method’ => ‘replace’, ‘effect’ => ‘fade’, ), AJAX + $commands[] + Drupal.ajax.prototype...
  10. 10. Спасибо за внимание!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×