pdfview re-enabling itself

samhare - April 27, 2007 - 13:56
Project:Pdfview
Version:5.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi there,

I've had a slight problem with pdfview -- I was trying to disable it on all but one node type, but later found it had re-enabled itself in some cases. I think I tracked the problem down to the hook_form_alter(), which is currently using:

'#default_value' => variable_get('pdfview_'.$form['identity']['type']['#default_value'], 1)

'$form['identity']['type']['#default_value'] does not seem to reliably defined for all node types, so in some cases the form will not find the variable and hence default back to 1 again. Changing this to:

'#default_value' => variable_get('pdfview_'.$form['#node_type']->type, 1)

seems to have solved the problem.

Thanks,

Sam.

#1

rconstantine - September 1, 2007 - 04:03

You should probably also change this:
if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
to this:
if ($form_id == 'node_type_form' && isset($form['#node_type']->type)) {
just for consistency.

Or am I wrong?

 
 

Drupal is a registered trademark of Dries Buytaert.