0

I need to edit a field added to my $content variable by a contrib module called Print, email, and PDF versions. It creates a link at the top of the content region that says 'Print PDF' and prints a PDF of the page. I've looked everywhere in the admin settings for the module for this information but can't find it anywhere.

Note: I've tried looking in my DB and trying what I found in there for the field, with no luck. I also tried using var_dump but that doesn't help me. I looked in the print.module file but wasn't seeing anything in there, although to be fair it's quite voluminous so I might have missed something.

I'm trying to access it and hide it through code in node--resource.tpl.php so I can manipulate it independently of the rest of the vars in $content. This is the code I'm using successfully to hide OTHER items in $content for example:

// #nomarkup is a function defined in template.php
$content['field_body']['#theme'] = "nomarkup";
hide($content['field_body']);

With Firebug, the DOM shows followed by for the PRINT PDF link I want to hide, but neither of those seems to be recognized when I try to hide them using a similar format as the other items in $content, like so:

$content['print-link']['#theme'] 

or

$content['print_pdf']['#theme'] 

respectively. I even tried removing the ['#theme'] part but that didn't help.

Anyone know a good way to find the machine name of this variable that seems to have been added to $content but is not showing in admin > content type?

1

Install the devel module and use dpm($content) to inspect the content variable.

A good place to adjust the contents of a page in your theme is in a preprocess function.

  • You're right about using devel; that helped me find it. Thank you. – Sage Feb 17 '15 at 9:43

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.