You are here

function hook_print_link in Printer, email and PDF versions 7.2

Provides the format-specific info to be used by the print_ui module.

The print_ui module manages all the generic link management of the print package sub-modules. In order to keep the code as generic as possible, all the identified information necessary to build the link is provided as an array, from which each of the print_ui functions can access the necessary details. The print_ui module will iterate over all modules that implement this hook and build a link pointing to the indicated path + node id (or url alias). For convenience, this function should be called directly inside the hook_menu call for each module, and the returned path value used as the main entry point of the specific functionality.

Return value

array An associative array containing:

  • format: The format identifier, must be unique among all modules. Examples: 'html', 'mail, 'pdf'.
  • text: The default string used in the link text. Overridable by the user configuration settings in the sub-module page.
  • description: The text shown when hovering over the link.
  • path: The unique path used to call the main handler.
  • class: The default value of the CSS class used in the 'a' tag of the link. Overridable by the user configuration settings in the sub-module page.
  • icon: the filename of the image used as the link icon.
  • module: the name of the module. Used to call common functions or access tables, as not all module names follow the 'print_format' template (e.g. print.module and not print_html.module).

Related topics

4 functions implement hook_print_link()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

print_epub_print_link in print_epub/print_epub.module
Implements hook_print_link().
print_mail_print_link in print_mail/print_mail.module
Implements hook_print_link().
print_pdf_print_link in print_pdf/print_pdf.module
Implements hook_print_link().
print_print_link in ./print.module
Implements hook_print_link().
10 invocations of hook_print_link()
print_ui_block_view in print_ui/print_ui.module
Implements hook_block_view().
print_ui_form_alter in print_ui/print_ui.module
Implements hook_form_alter().
print_ui_help in print_ui/print_ui.module
Implements hook_help().
print_ui_node_delete in print_ui/print_ui.module
Implements hook_node_delete().
print_ui_node_load in print_ui/print_ui.module
Implements hook_node_load().

... See full list

File

print_ui/print_ui.api.php, line 44
Hooks provided by the Print UI module.

Code

function hook_print_link() {
  return array(
    'format' => 'foo',
    'text' => t('Foo version'),
    'description' => t('Display the foo version of this page.'),
    'path' => 'printfoo',
    'class' => 'print-foo',
    'icon' => 'foo_icon.png',
    'module' => 'print_foo',
  );
}