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.
| Attachment | Size |
|---|---|
| unrequire_comments.patch | 948 bytes |

#1
4.7 is now in maintenance mode, so new features should go against Drupal 5 only. Thanks.
#2
ok, here is a patch for 5.x.
Also, that first patch was soooooooo wrong. I don't know what I was thinking...
#3
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
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
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!