I want to print a custom module in a type of content already created through the interface. Is there any way to print it?

I have seen that one of the ways in drupal 7 to print the module is by using the 'module_invoke' function, is there any equivalent in drupal 8 to print in a twig template?



Copy Print's print.tpl.php file into module folder, and name it print--node--foo.tpl.php.

function foo_theme_registry_alter(&$theme_registry) { $theme_registry['print__node__foo']['template'] = 'print--node--foo'; $theme_registry['print__node__foo']['path'] = drupal_get_path('module', 'foo'); }

Note: My module and content type share the same name of foo.

|improve this answer|||||
  • @ SrMiguel if it works then accept my answer thanks! – Piyush Nov 14 '17 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.