make review box optional

greggles - November 27, 2006 - 21:13
Project:NodeReview
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

This simple patch makes the "Review" box optional.

In concert with http://drupal.org/node/100043 it makes it possible for users to provide ratings and an overall perspective rather than comments on each axis.

AttachmentSize
unrequire_comments.patch948 bytes

#1

Crell - February 25, 2007 - 03:16
Version:4.7.x-1.x-dev» 5.x-1.x-dev
Status:needs review» needs work

4.7 is now in maintenance mode, so new features should go against Drupal 5 only. Thanks.

#2

greggles - April 9, 2007 - 18:13
Status:needs work» needs review

ok, here is a patch for 5.x.

Also, that first patch was soooooooo wrong. I don't know what I was thinking...

AttachmentSize
reviews_optional.patch 846 bytes

#3

Crell - April 9, 2007 - 22:01
Status:needs review» needs work

This makes reviews optional unconditionally. That means you can't make the review portion required even if you wanted to. That's not really an improvement over it being required unconditionally (the current seutp).

If you can make it configurable per-axis or even per review type, that I'd commit.

#4

greggles - April 10, 2007 - 02:13
Assigned to:greggles» Anonymous

Well, it is somewhat better in that you can make it required by using a hook_form_alter to set #required => TRUE whereas in the current condition (with the custom validation function) you can't do that. right?

I'm unlikely to write that feature as the site that it's on will probably never see life after this incarnation so I'm unassigning myself. so, if anyone needs this feel free to run with it.

#5

najibx - August 11, 2008 - 10:03

I simply want to remove all review per axis and have 1 overall review (a must) at the bottom.

Completely Remove this. Simply remove #required' => TRUE will show the textarea, just not make it a must. so I remove it.

  $form['reviews'][$axis->aid]['review'] = array(
    '#type' => 'textarea',
    '#title' => t('Review'),
    '#default_value' => $reviews[$axis->aid]->review,
    '#required' => TRUE,
  );

But instead I add this in function nodereview_form

    $form['review'] = array(
    '#type' => 'textarea',
    '#title' => t('Review'),
    '#default_value' => $node->review,
    '#weight' => 10,
    '#required' => TRUE
  );

I got the display and validation I wanted, but of course the data are not being save... then I realize I would hack too much, and will get into trouble later when upgrading. An option for this kind of customization is great!

 
 

Drupal is a registered trademark of Dries Buytaert.