shortcode.api.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @file
  4. * Shortcode API documentation.
  5. */
  6. /**
  7. * hook_shortcode_info()
  8. * Declare shortcodes
  9. *
  10. * @return
  11. * An associative array of shortcodes, whose keys are internal shortcode names,
  12. * which should be unique..
  13. * Each value is an associative array describing the shortcode, with the
  14. * following elements (all are optional except as noted):
  15. * - title: (required) An administrative summary of what the shortcode does.
  16. * - description: Additional administrative information about the shortcode's
  17. * behavior, if needed for clarification.
  18. * - settings callback: The name of a function that returns configuration form
  19. * elements for the shortcode. TODO
  20. * - default settings: An associative array containing default settings for
  21. * the shortcode, to be applied when the shortcode has not been configured yet.
  22. * - process callback: (required) The name the function that performs the
  23. * actual shortcodeing.
  24. * - tips callback: The name of a function that returns end-user-facing shortcode
  25. * usage guidelines for the shortcode.
  26. *
  27. */
  28. function hook_shortcode_info() {
  29. // Quote shortcode example
  30. $shortcodes['quote'] = array(
  31. 'title' => t('Quote'),
  32. 'description' => t('Replace a given text formatted like a quote.'),
  33. 'process callback' => 'shortcode_basic_tags_shortcode_quote',
  34. //'settings callback' => '_shortcode_settings_form', TODO
  35. 'tips callback' => 'shortcode_basic_tags_shortcode_quote_tip',
  36. 'default settings' => array(),
  37. );
  38. return $shortcodes;
  39. }