Page-title breaks CCK's content-copy.

manarth - September 19, 2009 - 17:38
Project:Page Title
Version:6.x-2.2
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:fixed
Description

With page title enabled, CCK exports are invalid and cannot be imported - if you attempt to import a CCK content-type, it fails stating: "An illegal choice has been detected. Please contact the site administrator."

Steps to reproduce:

  1. install Drupal 6.13, CCK 6.x-2.4 and Page-title 6.x-2.2
  2. ensure the content module, content-copy module and page title modules are enabled
  3. export any content type (at admin/content/types/export) - copy the export code to clipboard or a temporary file
  4. remove the content type
  5. import the content type (at admin/content/types/import) using the previously supplied export code

Result: Error message is displayed
Expected result: Success message is displayed; content type is created

You can see the issue in the CCK exported code, where you'll find a section which reads:

  'page_title' =>
  array (
    'show_field' =>
    array (
      0 => 1,
      'show_field' => false,
    ),
    'pattern' => '',
  ),

The line containing 0 => 1 is invalid and breaks the export.

The error is caused by line 189 in page_title.module, in the form_alter function:

'#default_value' => array('show_field' => variable_get('page_title_type_'. $form['#node_type']->type .'_showfield', 0) ? 'show_field' : 0),

The format for #default_value on checkboxes is array('foo', 'bar'), not array('foo' => 'foo', 'bar' => 'bar') - this is described in comment 7 of http://drupal.org/node/216295#comment-725034

Line 189 could read:

'#default_value' => variable_get('page_title_type_'. $form['#node_type']->type .'_showfield', 0) ? array('show_field') : array(),

Patch attached.

Using Drupal 6.13, CCK 6.x-2.4 and Page-title 6.x-2.2

AttachmentSize
page_title.module.patch605 bytes

#1

manarth - September 19, 2009 - 17:39
Status:active» needs review

#2

fuerst - November 4, 2009 - 07:26
Status:needs review» reviewed & tested by the community

The patch fixes the problem for me, thanks.

#3

PieIsGood - November 14, 2009 - 23:50

Patch works for me, many thanks!

#4

nicholasThompson - November 23, 2009 - 16:08
Status:reviewed & tested by the community» fixed

Applied to Drupal 5, 6 and 7 dev branches. Will be included in the next release. Cheers guys :-)

 
 

Drupal is a registered trademark of Dries Buytaert.