hooks.rst 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .. _hooks:
  2. Hooks
  3. =====
  4. In FlaskBB we distinguish from `Python Hooks <#python-hooks>`_ and
  5. `Template Hooks <#template-hooks>`_.
  6. Python Hooks are prefixed with ``flaskbb_`` and called are called in Python
  7. files whereas Template Hooks have to be prefixed with ``flaskbb_tpl_`` and are
  8. executed in the templates.
  9. If you miss a hook, feel free to open a new issue or create a pull
  10. request. The pull request should always contain a entry in this document
  11. with a small example.
  12. A hook needs a hook specification which are defined in
  13. :mod:`flaskbb.plugins.spec`. All hooks have to be prefixed with
  14. ``flaskbb_`` and template hooks with ``flaskbb_tpl_``.
  15. Python Hooks
  16. ------------
  17. .. currentmodule:: flaskbb.plugins.spec
  18. .. autofunction:: flaskbb_extensions
  19. .. autofunction:: flaskbb_load_translations
  20. .. autofunction:: flaskbb_load_migrations
  21. .. autofunction:: flaskbb_load_blueprints
  22. .. autofunction:: flaskbb_request_processors
  23. .. autofunction:: flaskbb_errorhandlers
  24. .. autofunction:: flaskbb_jinja_directives
  25. .. autofunction:: flaskbb_additional_setup
  26. .. autofunction:: flaskbb_cli
  27. Template Hooks
  28. --------------
  29. .. note::
  30. Template hooks, which are used in forms, are usually rendered after the
  31. hidden CSRF token field and before an submit field.
  32. .. autofunction:: flaskbb_tpl_before_navigation
  33. .. autofunction:: flaskbb_tpl_after_navigation
  34. .. autofunction:: flaskbb_tpl_before_registration_form
  35. .. autofunction:: flaskbb_tpl_after_registration_form
  36. .. autofunction:: flaskbb_tpl_before_user_details_form
  37. .. autofunction:: flaskbb_tpl_after_user_details_form