Book Review crashes into Excerpt, replaces Excerpt teaser.

peterx - January 8, 2007 - 06:13
Project:Book Review
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Book Review replaces the teaser created by Excerpt. I added a Book Review setting to not replace teasers.

Excerpt creates the teaser during nodeapi validate. Book Review replaces the teaser during submit. You could have automatic settings to not replace the teaser if module Excerpt is loaded or if the teaser is not empty. Checking for another module is not good except to create the default for the setting. Checking for an empty teaser will not work if the modules execute in a different sequence. A manual setting is the easiest and most predictable option.

At the end of function bookreview_settings(), add the following setting:

<?php
    $form
['bookreview_settings']['bookreview_do_not_change_teaser'] =
        array(
       
'#type' => 'checkbox',
       
'#title' => t('Do not change teasers'),
       
'#default_value' => variable_get('bookreview_do_not_change_teaser', false),
       
'#description' => t('Do not change teasers. Let Excerpt create the teaser.'),
        );
?>

Add the following test at the start of function bookreview_submit(&$node):

<?php
   
if(variable_get('bookreview_do_not_change_teaser', false))
        {
        return;
        }
?>

petermoulding.com/web_architect

 
 

Drupal is a registered trademark of Dries Buytaert.