Overriding templates per node type

Created on 29 March 2018, over 6 years ago
Updated 11 January 2024, 12 months ago

i'm using the following in my HOOK_theme(), and it works; it uses entity-print--node.tpl.php in my module dir:

    'entity_print__node' => array(
      'base hook' => 'entity_print',
      'template' => 'templates/entity-print--node',
      'path' => drupal_get_path('module', 'mycc_custom'),
    ),

however now that i want to create a derivative for a different node type, i'm unable to get it going..
the machine name of the content type i'm trying to generate a pdf for is 'university_badge_profile', and the variations of the following i've tried aren't working:

    'entity_print__university_badge_profile' => array(
      'base hook' => 'entity_print',
      'template' => 'templates/entity-print--university-badge-profile',
      'path' => drupal_get_path('module', 'mycc_custom'),
    ),

i had hoped this would use the entity-print--university-badge-profile.tpl.php template from my module dir, but it doesn't. if i remove the 'path', it doesn't find the template in the theme dir either..

attempting to access the output via /entityprint/university_badge_profile/75/debug results in the following error message:
Fatal error: Class name must be a valid object or a string in /srv/bindings/54c03808a5a2420ba0edf237cc4c33ce/code/includes/common.inc on line 8068
so it's clear i'm not going about this the right way..

how should this be declared with regards to different node types?

πŸ’¬ Support request
Status

Closed: works as designed

Version

1.5

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States dLux

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024