Drupal Forms, api

Simplenews newsletter i szablon w html

template : http://drupal.org/node/268404
footer : http://drupal.org/node/321012

Templates

http://www.styleshout.com/free-templates.php

Co mozna zrobic w module.install:

http://www.databasepublish.com/blog/using-drupal-module-install-scripts-...
http://www.lullabot.com/articles/moving-cck-field-changes-from-dev-to-live

User Profile Picture:

http://www.lullabot.com/articles/imagecache_example_user_profile_pictures

API

http://api.drupal.org/api/

Nowego contenttype kodem PHP

http://api.drupal.org/api/file/developer/examples/node_example.module/5

Module developer’s guide:
http://drupal.org/node/508

Tworzenie nowego elementu formularza

http://www.akchauhan.com/create-drupal-form-elements-like-date-element/

FORMS

http://api.drupal.org/api/file/developer/topics/forms_api.html/4.7

  1. function test_form() {
  2. // Access log settings:
  3. $options = array('1' => t('Enabled'), '0' => t('Disabled'));
  4. $form['access'] = array(
  5. '#type' => 'fieldset',
  6. '#title' => t('Access log settings'),
  7. '#tree' => TRUE,
  8. );
  9. $form['access']['log'] = array(
  10. '#type' => 'radios',
  11. '#title' => t('Log'),
  12. '#default_value' => variable_get('log', 0),
  13. '#options' => $options,
  14. '#description' => t('The log.'),
  15. );
  16. $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
  17. $form['access']['timer'] = array(
  18. '#type' => 'select',
  19. '#title' => t('Discard logs older than'),
  20. '#default_value' => variable_get('timer', 259200),
  21. '#options' => $period,
  22. '#description' => t('The timer.'),
  23. );
  24. // Description
  25. $form['details'] = array(
  26. '#type' => 'fieldset',
  27. '#title' => t('Details'),
  28. '#collapsible' => TRUE,
  29. '#collapsed' => TRUE,
  30. );
  31. $form['details']['description'] = array(
  32. '#type' => 'textarea',
  33. '#title' => t('Describe it'),
  34. '#default_value' => variable_get('description', ''),
  35. '#cols' => 60,
  36. '#rows' => 5,
  37. '#description' => t('Log description.'),
  38. );
  39. $form['details']['admin'] = array(
  40. '#type' => 'checkbox',
  41. '#title' => t('Only admin can view'),
  42. '#default_value' => variable_get('admin', 0),
  43. );
  44. $form['name'] = array(
  45. '#type' => 'textfield',
  46. '#title' => t('Name'),
  47. '#size' => 30,
  48. '#maxlength' => 64,
  49. '#description' => t('Enter the name for this group of settings'),
  50. );
  51. $form['hidden'] = array('#type' => 'value', '#value' => 'is_it_here');
  52. $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
  53. return $form;
  54. }
  55.  
  56. function test_page() {
  57. return drupal_get_form('test_form');
  58. }