API.txt

  1. cis7 sites/all/modules/ulmus/pathauto/API.txt
  2. cis7 sites/all/modules/ulmus/security_review/API.txt
  3. cis7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  4. cis7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  5. cis7 sites/all/modules/ulmus/ctools/API.txt
  6. cis7 sites/all/modules/ulmus/context/API.txt
  7. cis7 sites/all/modules/ulmus/aes/API.txt
  8. cis7 sites/all/modules/ulmus/media/API.txt
  9. cis7 sites/all/modules/ulmus/features/API.txt
  10. cle7 sites/all/modules/ulmus/security_review/API.txt
  11. cle7 sites/all/modules/ulmus/features/API.txt
  12. cle7 sites/all/modules/ulmus/media/API.txt
  13. cle7 sites/all/modules/ulmus/pathauto/API.txt
  14. cle7 sites/all/modules/ulmus/context/API.txt
  15. cle7 sites/all/modules/ulmus/ctools/API.txt
  16. cle7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  17. cle7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  18. cle7 sites/all/modules/ulmus/aes/API.txt
  19. cle7 sites/all/modules/local_contrib/votingapi/API.txt
  20. ecd7 sites/all/modules/ulmus/aes/API.txt
  21. ecd7 sites/all/modules/ulmus/ctools/API.txt
  22. ecd7 sites/all/modules/ulmus/security_review/API.txt
  23. ecd7 sites/all/modules/ulmus/context/API.txt
  24. ecd7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  25. ecd7 sites/all/modules/ulmus/media/API.txt
  26. ecd7 sites/all/modules/ulmus/features/API.txt
  27. ecd7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  28. ecd7 sites/all/modules/ulmus/pathauto/API.txt
  29. elmsmedia7 sites/all/modules/ulmus/security_review/API.txt
  30. elmsmedia7 sites/all/modules/ulmus/aes/API.txt
  31. elmsmedia7 sites/all/modules/ulmus/features/API.txt
  32. elmsmedia7 sites/all/modules/ulmus/ctools/API.txt
  33. elmsmedia7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  34. elmsmedia7 sites/all/modules/ulmus/media/API.txt
  35. elmsmedia7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  36. elmsmedia7 sites/all/modules/ulmus/pathauto/API.txt
  37. elmsmedia7 sites/all/modules/ulmus/context/API.txt
  38. harmony7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  39. harmony7 sites/all/modules/ulmus/features/API.txt
  40. harmony7 sites/all/modules/ulmus/context/API.txt
  41. harmony7 sites/all/modules/ulmus/media/API.txt
  42. harmony7 sites/all/modules/ulmus/pathauto/API.txt
  43. harmony7 sites/all/modules/ulmus/ctools/API.txt
  44. harmony7 sites/all/modules/ulmus/aes/API.txt
  45. harmony7 sites/all/modules/ulmus/security_review/API.txt
  46. harmony7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  47. icor7 sites/all/modules/ulmus/security_review/API.txt
  48. icor7 sites/all/modules/ulmus/context/API.txt
  49. icor7 sites/all/modules/ulmus/pathauto/API.txt
  50. icor7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  51. icor7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  52. icor7 sites/all/modules/ulmus/ctools/API.txt
  53. icor7 sites/all/modules/ulmus/features/API.txt
  54. icor7 sites/all/modules/ulmus/media/API.txt
  55. icor7 sites/all/modules/ulmus/aes/API.txt
  56. meedjum_blog7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  57. meedjum_blog7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  58. meedjum_blog7 sites/all/modules/ulmus/aes/API.txt
  59. meedjum_blog7 sites/all/modules/ulmus/security_review/API.txt
  60. meedjum_blog7 sites/all/modules/ulmus/ctools/API.txt
  61. meedjum_blog7 sites/all/modules/ulmus/context/API.txt
  62. meedjum_blog7 sites/all/modules/ulmus/pathauto/API.txt
  63. meedjum_blog7 sites/all/modules/ulmus/media/API.txt
  64. meedjum_blog7 sites/all/modules/ulmus/features/API.txt
  65. mooc7 sites/all/modules/ulmus/aes/API.txt
  66. mooc7 sites/all/modules/ulmus/ctools/API.txt
  67. mooc7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  68. mooc7 sites/all/modules/ulmus/security_review/API.txt
  69. mooc7 sites/all/modules/ulmus/context/API.txt
  70. mooc7 sites/all/modules/ulmus/pathauto/API.txt
  71. mooc7 sites/all/modules/ulmus/media/API.txt
  72. mooc7 sites/all/modules/ulmus/features/API.txt
  73. mooc7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
This document explains how to provide "Pathauto integration" in a
module. You need this if you would like to provide additional tokens
or if your module has paths and you wish to have them automatically
aliased.  The simplest integration is just to provide tokens so we
cover that first.  More advanced integration requires an
implementation of hook_pathauto to provide a settings form.

It may be helpful to review some examples of integration from the
pathauto_node.inc, pathauto_taxonomy.inc, and pathauto_user.inc files.


==================
1 - Providing additional tokens
==================

If all you want is to enable tokens for your module you will simply
need to implement two functions:

  hook_token_values
  hook_token_list

See the token.module and it's API.txt for more information about this
process.

If the token is intended to generate a path expected to contain slashes,
the token name must end in 'path', 'path-raw' or 'alias'. This indicates to
Pathauto that the slashes should not be removed from the replacement value.

When an object is created (whether it is a node or a user or a
taxonomy term) the data that Pathauto hands to the token_values in the
$object is in a specific format. This is the format that most people
write code to handle. However, during edits and bulk updates the data
may be in a totally different format. So, if you are writing a
hook_token_values implementation to add special tokens, be sure to
test creation, edit, and bulk update cases to make sure your code will
handle it.

==================
2 - Settings hook - To create aliases for your module
==================
You must implement hook_pathauto($op), where $op is always (at this
time) 'settings'. Return an object (NOT an array) containing the
following members, which will be used by pathauto to build a group
of settings for your module and define the variables for saving your
settings:

module - The name of your module (e.g., 'node')
groupheader - The translated label for the settings group (e.g.,
  t('Content path settings')
patterndescr - The translated label for the default pattern (e.g.,
  t('Default path pattern (applies to all content types with blank patterns below)')
patterndefault - A translated default pattern (e.g., t('[cat]/[title].html'))
token_type - The token type (e.g. 'node', 'user') that can be used.
patternitems - For modules which need to express multiple patterns
  (for example, the node module supports a separate pattern for each
  content type), an array whose keys consist of identifiers for each
  pattern (e.g., the content type name) and values consist of the
  translated label for the pattern
bulkname - For modules which support a bulk update operation, the
  translated label for the action (e.g., t('Bulk update content paths'))
bulkdescr - For modules which support a bulk update operation, a
  translated, more thorough description of what the operation will do
  (e.g., t('Generate aliases for all existing content items which do not already have aliases.'))


==================
2 - $alias = pathauto_create_alias($module, $op, $placeholders, $src, $type=NULL)
==================

At the appropriate time (usually when a new item is being created for
which a generated alias is desired), call pathauto_create_alias() to
generate and create the alias.  See the user, taxonomy, and nodeapi hook
implementations in pathauto.module for examples.

$module - The name of your module (e.g., 'node')
$op - Operation being performed on the item ('insert', 'update', or
  'bulkupdate')
$placeholders - An array whose keys consist of the translated placeholders
  which appear in patterns and values are the "clean" values to be
  substituted into the pattern. Call pathauto_cleanstring() on any
  values which you do not know to be purely alphanumeric, to substitute
  any non-alphanumerics with the user's designated separator. Note that
  if the pattern has multiple slash-separated components (e.g., [term:path]),
  pathauto_cleanstring() should be called for each component, not the
  complete string.
  Example: $placeholders[t('[title]')] = pathauto_cleanstring($node->title);
$src - The "real" URI of the content to be aliased (e.g., "node/$node->nid")
$type - For modules which provided patternitems in hook_autopath(),
  the relevant identifier for the specific item to be aliased (e.g.,
  $node->type)

pathauto_create_alias() returns the alias that was created.


==================
3 - Bulk update function
==================

If a module supports bulk updating of aliases, it must provide a
function of this form, to be called by pathauto when the corresponding
checkbox is selected and the settings page submitted:

function <module>_pathauto_bulkupdate()

The function should iterate over the content items controlled by the
module, calling pathauto_create_alias() for each one. It is
recommended that the function report on its success (e.g., with a
count of created aliases) via drupal_set_message().


==================
4 - Bulk delete hook_path_alias_types()
==================

For modules that create new types of pages that can be aliased with pathauto, a
hook implementation is needed to allow the user to delete them all at once.

function hook_path_alias_types()

This hook returns an array whose keys match the beginning of the source paths
(e.g.: "node/", "user/", etc.) and whose values describe the type of page (e.g.:
"content", "users"). Like all displayed strings, these descriptionsshould be
localized with t(). Use % to match interior pieces of a path; "user/%/track". This
is a database wildcard, so be careful.


==================
Modules that extend node and/or taxonomy
==================

NOTE: this is basically not true any more.  If you feel you need this file an issue.

Many contributed Drupal modules extend the core node and taxonomy
modules. To extend pathauto patterns to support their extensions, they
may implement the pathauto_node and pathauto_taxonomy hooks.

To do so, implement the function <modulename>_pathauto_node (or _taxonomy),
accepting the arguments $op and $node (or $term). Two operations are
supported:

$op = 'placeholders' - return an array keyed on placeholder strings
(e.g., t('[eventyyyy]')) valued with descriptions (e.g. t('The year the
event starts.')).
$op = 'values' - return an array keyed on placeholder strings, valued
with the "clean" actual value for the passed node or category (e.g.,
pathauto_cleanstring(date('M', $eventstart)));

See contrib/pathauto_node_event.inc for an example of extending node
patterns.

File

sites/all/modules/ulmus/pathauto/API.txt
View source
  1. This document explains how to provide "Pathauto integration" in a
  2. module. You need this if you would like to provide additional tokens
  3. or if your module has paths and you wish to have them automatically
  4. aliased. The simplest integration is just to provide tokens so we
  5. cover that first. More advanced integration requires an
  6. implementation of hook_pathauto to provide a settings form.
  7. It may be helpful to review some examples of integration from the
  8. pathauto_node.inc, pathauto_taxonomy.inc, and pathauto_user.inc files.
  9. ==================
  10. 1 - Providing additional tokens
  11. ==================
  12. If all you want is to enable tokens for your module you will simply
  13. need to implement two functions:
  14. hook_token_values
  15. hook_token_list
  16. See the token.module and it's API.txt for more information about this
  17. process.
  18. If the token is intended to generate a path expected to contain slashes,
  19. the token name must end in 'path', 'path-raw' or 'alias'. This indicates to
  20. Pathauto that the slashes should not be removed from the replacement value.
  21. When an object is created (whether it is a node or a user or a
  22. taxonomy term) the data that Pathauto hands to the token_values in the
  23. $object is in a specific format. This is the format that most people
  24. write code to handle. However, during edits and bulk updates the data
  25. may be in a totally different format. So, if you are writing a
  26. hook_token_values implementation to add special tokens, be sure to
  27. test creation, edit, and bulk update cases to make sure your code will
  28. handle it.
  29. ==================
  30. 2 - Settings hook - To create aliases for your module
  31. ==================
  32. You must implement hook_pathauto($op), where $op is always (at this
  33. time) 'settings'. Return an object (NOT an array) containing the
  34. following members, which will be used by pathauto to build a group
  35. of settings for your module and define the variables for saving your
  36. settings:
  37. module - The name of your module (e.g., 'node')
  38. groupheader - The translated label for the settings group (e.g.,
  39. t('Content path settings')
  40. patterndescr - The translated label for the default pattern (e.g.,
  41. t('Default path pattern (applies to all content types with blank patterns below)')
  42. patterndefault - A translated default pattern (e.g., t('[cat]/[title].html'))
  43. token_type - The token type (e.g. 'node', 'user') that can be used.
  44. patternitems - For modules which need to express multiple patterns
  45. (for example, the node module supports a separate pattern for each
  46. content type), an array whose keys consist of identifiers for each
  47. pattern (e.g., the content type name) and values consist of the
  48. translated label for the pattern
  49. bulkname - For modules which support a bulk update operation, the
  50. translated label for the action (e.g., t('Bulk update content paths'))
  51. bulkdescr - For modules which support a bulk update operation, a
  52. translated, more thorough description of what the operation will do
  53. (e.g., t('Generate aliases for all existing content items which do not already have aliases.'))
  54. ==================
  55. 2 - $alias = pathauto_create_alias($module, $op, $placeholders, $src, $type=NULL)
  56. ==================
  57. At the appropriate time (usually when a new item is being created for
  58. which a generated alias is desired), call pathauto_create_alias() to
  59. generate and create the alias. See the user, taxonomy, and nodeapi hook
  60. implementations in pathauto.module for examples.
  61. $module - The name of your module (e.g., 'node')
  62. $op - Operation being performed on the item ('insert', 'update', or
  63. 'bulkupdate')
  64. $placeholders - An array whose keys consist of the translated placeholders
  65. which appear in patterns and values are the "clean" values to be
  66. substituted into the pattern. Call pathauto_cleanstring() on any
  67. values which you do not know to be purely alphanumeric, to substitute
  68. any non-alphanumerics with the user's designated separator. Note that
  69. if the pattern has multiple slash-separated components (e.g., [term:path]),
  70. pathauto_cleanstring() should be called for each component, not the
  71. complete string.
  72. Example: $placeholders[t('[title]')] = pathauto_cleanstring($node->title);
  73. $src - The "real" URI of the content to be aliased (e.g., "node/$node->nid")
  74. $type - For modules which provided patternitems in hook_autopath(),
  75. the relevant identifier for the specific item to be aliased (e.g.,
  76. $node->type)
  77. pathauto_create_alias() returns the alias that was created.
  78. ==================
  79. 3 - Bulk update function
  80. ==================
  81. If a module supports bulk updating of aliases, it must provide a
  82. function of this form, to be called by pathauto when the corresponding
  83. checkbox is selected and the settings page submitted:
  84. function _pathauto_bulkupdate()
  85. The function should iterate over the content items controlled by the
  86. module, calling pathauto_create_alias() for each one. It is
  87. recommended that the function report on its success (e.g., with a
  88. count of created aliases) via drupal_set_message().
  89. ==================
  90. 4 - Bulk delete hook_path_alias_types()
  91. ==================
  92. For modules that create new types of pages that can be aliased with pathauto, a
  93. hook implementation is needed to allow the user to delete them all at once.
  94. function hook_path_alias_types()
  95. This hook returns an array whose keys match the beginning of the source paths
  96. (e.g.: "node/", "user/", etc.) and whose values describe the type of page (e.g.:
  97. "content", "users"). Like all displayed strings, these descriptionsshould be
  98. localized with t(). Use % to match interior pieces of a path; "user/%/track". This
  99. is a database wildcard, so be careful.
  100. ==================
  101. Modules that extend node and/or taxonomy
  102. ==================
  103. NOTE: this is basically not true any more. If you feel you need this file an issue.
  104. Many contributed Drupal modules extend the core node and taxonomy
  105. modules. To extend pathauto patterns to support their extensions, they
  106. may implement the pathauto_node and pathauto_taxonomy hooks.
  107. To do so, implement the function _pathauto_node (or _taxonomy),
  108. accepting the arguments $op and $node (or $term). Two operations are
  109. supported:
  110. $op = 'placeholders' - return an array keyed on placeholder strings
  111. (e.g., t('[eventyyyy]')) valued with descriptions (e.g. t('The year the
  112. event starts.')).
  113. $op = 'values' - return an array keyed on placeholder strings, valued
  114. with the "clean" actual value for the passed node or category (e.g.,
  115. pathauto_cleanstring(date('M', $eventstart)));
  116. See contrib/pathauto_node_event.inc for an example of extending node
  117. patterns.
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.