README.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. Automatic Nodetitle Module
  2. ------------------------
  3. by Wolfgang Ziegler, nuppla@zites.net
  4. Description
  5. -----------
  6. This is a small and efficent module that allows hiding of the content title field in the form.
  7. To prevent empty content title fields it sets the title to the content type name or to an
  8. configurable string. It is possible to use various content data for the autogenerated title,
  9. e.g. the token [current-user:name] is going to be replaced with the currently logged in
  10. users name. If the token module is installed, a list of possible replacement patterns
  11. will be shown.
  12. Advanced users can also provide some PHP code, that is used for automatically generating an
  13. appropriate title.
  14. Installation
  15. ------------
  16. * (optional) Download and install the token module in order to get token
  17. replacement help.
  18. * Copy the module's directory to your modules directory and activate the module.
  19. * For each content type you want to have an automatic title, configure the
  20. module at 'admin/structure/types'.
  21. Note
  22. -----
  23. Due to the way the module works, it is not possible to make use of some replacement
  24. tokens that are not available before the content node is saved the first time, e.g.
  25. like the node id ([node:nid]).
  26. Advanced Use: PHP Code
  27. ------------------------
  28. You can access $node from your php code. Look at this simple example, which just adds the node's
  29. author as title:
  30. <?php return "Author: $node->name"; ?>
  31. Advanced Use: Combining tokens and PHP
  32. ---------------------------------------
  33. You can combine php evalution with the token module, because tokens are replaced first.
  34. However be aware to don't use this with any textual values provided by users as this would
  35. open a security hole. If you are in doubt, don't combine tokens with php evaluation.
  36. Here is an example:
  37. <?php
  38. $token = '[field_testnumber]';
  39. if (empty($token)) {
  40. return '[type]';
  41. }
  42. else {
  43. return $token;
  44. }
  45. ?>
  46. So if the text of the number field [field_testnumber] isn't empty it will be used as title.
  47. Otherwise the node type will be used.
  48. Updating nodetitles from existing nodes
  49. ---------------------------------------
  50. If you set the nodetitle to be auto generated for some content type, existing nodes
  51. are not affected. You can update existing nodes by going to 'admin/content',
  52. then filter for your content type, mark some nodes and choose the "Update option"
  53. "Update automatic nodetitles".