Search »

Hooks Manager

Custom Hooks

"Custom" hooks is a new idea that, to be perfectly frank, has yet to be polished. Think of this feature as Very-Much-In-Beta. I thought it would be helpful to use the Hooks Manager to insert snippets of markup/code in other places throughout the application, not just in the predetermined template and hook locations. For instance, it would be nice to use the Pages modules to insert dynamic content - e.g. lists of forms, lists of submissions - and not just static HTML content. Or perhaps it would be handy to be able to have hooks within some of the modules.

This is what this feature is about.

As a simple example of this hook, upgrade to the latest version of the Pages module. Then follow these steps:

  1. In the Hooks Manager, create a custom hook and enter "hello_world" for the Custom Hook field.
  2. Select "HTML" as the content type.
  3. Enter "Hello World!" as the content.
  4. Go to the Pages module and create a new page.
  5. Select "Smarty" as the content type and enter the following into the Page Content field:
  6. Finally, return to the Pages main page (the one that lists all Pages) and click the "VIEW" link. Notice that the custom hook you entered has been replaced by whatever hook content you entered!