Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
it looks like apart from 'full' and 'teaser' view modes, the print link cannot be displayed, indeed:
<?php
function print_ui_link_allowed($link, $args) {
if (isset($args['view_mode'])) {
$view_mode = $args['view_mode'];
if ((($view_mode == 'teaser') && !variable_get('print_' . $link['format'] . '_link_teaser', PRINT_UI_LINK_TEASER_DEFAULT))
|| !in_array($view_mode, array('full', 'teaser'))) {
// If the teaser link is disabled
return FALSE;
}
}
$link_allowed_func = $link['module'] . '_link_allowed';
?>
this
<?php
!in_array($view_mode, array('full', 'teaser'))
?>
systematically returns false for a custom view mode, so even though you define a custom condition using hook_link_allowed, it is never called...
and even though it would pass this check, module has to actually also implement hook_print_link and define its own table for
<?php
function print_ui_node_load($nodes, $types) {
...
$result = db_query('SELECT nid, link, comments, url_list FROM {' . $module . '_node_conf} WHERE nid IN (:nids)', array(':nids' => $ids))->fetchAllAssoc('nid');
?>
to pass.
that's quite heavy to simply display a basic print link...
please remove this part of the condition as it is very restrictive and does not correspond to the comment below (teaser link is disabled).
Comment | File | Size | Author |
---|---|---|---|
#2 | Allow-custom-view-modes-2621366-2.patch | 743 bytes | miaoulafrite |
Comments
Comment #2
miaoulafrite CreditAttribution: miaoulafrite commented