You are here

README.txt in Automatic Entity Label 7

Same filename and directory in other branches
  1. 8.3 README.txt
  2. 8 README.txt
  3. 8.2 README.txt
CONTENTS OF THIS FILE
---------------------
   
 * Introduction
 * Requirements
 * Installation
 * Configuration
 * Notes
 * Advanced use: PHP Code
 * Maintainers


INTRODUCTION
------------

by Benedikt Forchhammer, b.forchhammer@mind2.de

Based on the Automatic Node Titles module by Wolfgang Ziegler, nuppla@zites.net
Initial port to entities by Vasi Chindris, https://drupal.org/user/342104

This is a small and efficient module that allows hiding of entity label fields.
To prevent empty labels it can be configured to generate the label automatically
by a given pattern. The module can be used for any entity type that has a label,
including e.g. for node titles, comment subjects, taxonomy term names and
profile2 labels.

Patterns for automatic labels are constructed with the help of tokens. Drupal
core provides a basic set of tokens [1]. For a token selection widget install
the token module [2]. Some entity types (e.g. profile2) provide tokens via the
entity_token module, which is part of the entity module [3].

Advanced users can use PHP code for automatically generating labels. See below
for more information.


REQUIREMENTS
------------

No special requirements


INSTALLATION
------------

Install as you would normally install a contributed Drupal module. See:
https://drupal.org/documentation/install/modules-themes/modules-7 for further
information.

 * (optional) Download and install the token module in order to get token
   replacement help.


CONFIGURATION
-------------

 * Configure in Structure » Automatic label
   Select the Content type and input values in "Pattern for the label" field.

 * For each content type you want to have an automatic title, configure the
   module bundle configuration page, e.g. 'admin/structure/types' for content
   types


NOTES
-----
 1) Due to the way the module works, it is currently not possible to make use
    of some replacement tokens which are not available before the content node
    is saved the first time, e.g. the node id ([node:nid]). See issue #1445124
    if you are interested in this behavior [4].

 2) This module grew out of the Automatic node titles module and aims to be a
    full replacement. During installation all auto_nodetitle variables (ant_*)
    are automatically migrated to this module and deleted to prevent conflicts
    between both modules. There is currently no way to undo this process.

 3) Automatic entity labels also works with title replacements provided by the
    Title module [5].

 4) When you change the pattern for automatic labels, existing entities are not
    updated automatically. For 'node' entities you can use the 'batch update'
    feature on the 'admin/content' page to update the title of existing nodes to
    your new pattern. This is currently not possible for other entity types.

ADVANCED USE: PHP CODE
----------------------

Users which have the 'use PHP for label patterns' permission can use PHP code
within patterns for automatic label genereration.

Here is a simple example, which just adds the node's author as title:

	<?php return "Author: $entity->name"; ?>

Two variables are available for use:
- $entity : the entity for which the label is generated
- $language : the intended language of the label

You can also combine tokens with PHP evaluation. Be aware that this can lead to
security holes if you use textual values provided by users. If in doubt, avoid
combining tokens with php evaluation.

Here is an example, which sets an entity label to the value of a field
(field_testnumber), or the entity bundle (node type) if the field value is
empty.
 
<?php
  $token = '[field_testnumber]';
if (empty($token)) {
  return '[type]';
}
else {
  return $token;
}
?>


MAINTAINERS
-----------

Current maintainers:
 * Benedikt Forchhammer (bforchhammer) - https://www.drupal.org/user/216396
 * Pravin raj (Pravin Ajaaz) - https://www.drupal.org/user/2910049
 * Purushotam Rai (purushotam.rai) - https://www.drupal.org/user/3193859
 * Renato Gonçalves (renatog) - https://www.drupal.org/user/3326031


LINK REFERENCES
---------------

1: http://drupal.org/documentation/modules/token
2: http://drupal.org/project/token
3: http://drupal.org/project/entity 
4: http://drupal.org/node/1445124
5: http://drupal.org/project/title

File

README.txt
View source
  1. CONTENTS OF THIS FILE
  2. ---------------------
  3. * Introduction
  4. * Requirements
  5. * Installation
  6. * Configuration
  7. * Notes
  8. * Advanced use: PHP Code
  9. * Maintainers
  10. INTRODUCTION
  11. ------------
  12. by Benedikt Forchhammer, b.forchhammer@mind2.de
  13. Based on the Automatic Node Titles module by Wolfgang Ziegler, nuppla@zites.net
  14. Initial port to entities by Vasi Chindris, https://drupal.org/user/342104
  15. This is a small and efficient module that allows hiding of entity label fields.
  16. To prevent empty labels it can be configured to generate the label automatically
  17. by a given pattern. The module can be used for any entity type that has a label,
  18. including e.g. for node titles, comment subjects, taxonomy term names and
  19. profile2 labels.
  20. Patterns for automatic labels are constructed with the help of tokens. Drupal
  21. core provides a basic set of tokens [1]. For a token selection widget install
  22. the token module [2]. Some entity types (e.g. profile2) provide tokens via the
  23. entity_token module, which is part of the entity module [3].
  24. Advanced users can use PHP code for automatically generating labels. See below
  25. for more information.
  26. REQUIREMENTS
  27. ------------
  28. No special requirements
  29. INSTALLATION
  30. ------------
  31. Install as you would normally install a contributed Drupal module. See:
  32. https://drupal.org/documentation/install/modules-themes/modules-7 for further
  33. information.
  34. * (optional) Download and install the token module in order to get token
  35. replacement help.
  36. CONFIGURATION
  37. -------------
  38. * Configure in Structure » Automatic label
  39. Select the Content type and input values in "Pattern for the label" field.
  40. * For each content type you want to have an automatic title, configure the
  41. module bundle configuration page, e.g. 'admin/structure/types' for content
  42. types
  43. NOTES
  44. -----
  45. 1) Due to the way the module works, it is currently not possible to make use
  46. of some replacement tokens which are not available before the content node
  47. is saved the first time, e.g. the node id ([node:nid]). See issue #1445124
  48. if you are interested in this behavior [4].
  49. 2) This module grew out of the Automatic node titles module and aims to be a
  50. full replacement. During installation all auto_nodetitle variables (ant_*)
  51. are automatically migrated to this module and deleted to prevent conflicts
  52. between both modules. There is currently no way to undo this process.
  53. 3) Automatic entity labels also works with title replacements provided by the
  54. Title module [5].
  55. 4) When you change the pattern for automatic labels, existing entities are not
  56. updated automatically. For 'node' entities you can use the 'batch update'
  57. feature on the 'admin/content' page to update the title of existing nodes to
  58. your new pattern. This is currently not possible for other entity types.
  59. ADVANCED USE: PHP CODE
  60. ----------------------
  61. Users which have the 'use PHP for label patterns' permission can use PHP code
  62. within patterns for automatic label genereration.
  63. Here is a simple example, which just adds the node's author as title:
  64. name"; ?>
  65. Two variables are available for use:
  66. - $entity : the entity for which the label is generated
  67. - $language : the intended language of the label
  68. You can also combine tokens with PHP evaluation. Be aware that this can lead to
  69. security holes if you use textual values provided by users. If in doubt, avoid
  70. combining tokens with php evaluation.
  71. Here is an example, which sets an entity label to the value of a field
  72. (field_testnumber), or the entity bundle (node type) if the field value is
  73. empty.
  74. $token = '[field_testnumber]';
  75. if (empty($token)) {
  76. return '[type]';
  77. }
  78. else {
  79. return $token;
  80. }
  81. ?>
  82. MAINTAINERS
  83. -----------
  84. Current maintainers:
  85. * Benedikt Forchhammer (bforchhammer) - https://www.drupal.org/user/216396
  86. * Pravin raj (Pravin Ajaaz) - https://www.drupal.org/user/2910049
  87. * Purushotam Rai (purushotam.rai) - https://www.drupal.org/user/3193859
  88. * Renato Gonçalves (renatog) - https://www.drupal.org/user/3326031
  89. LINK REFERENCES
  90. ---------------
  91. 1: http://drupal.org/documentation/modules/token
  92. 2: http://drupal.org/project/token
  93. 3: http://drupal.org/project/entity
  94. 4: http://drupal.org/node/1445124
  95. 5: http://drupal.org/project/title