Needs review
Project:
Primary Term
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Dec 2010 at 22:51 UTC
Updated:
30 Aug 2011 at 16:45 UTC
Jump to comment: Most recent file
Comments
Comment #1
schnippy commentedI figured out how to modify this through a form_alter hook:
It correctly adds the 'null' option to the top of the list but the '#required' validation isn't working on this so if this field is marked as 'required' on the content-type admin screen but the editor leaves this option set to this new null value, it will still validate.
Comment #2
therzog commentedI second the motion for a null term. I my case, the vocabulary to which I'm applying primary term is optional. However, primary_term automatically sets the PT in the vocabulary, so even if I haven't selected anything, PT sets a term anyway, because there is no "not selected" option.
For now, thanks for the workaround, schnippy!
Comment #3
goldI just had to scratch this itch for a project I'm working on too.
The attached patch (svn diff) adds a blank --Select-- entry to the terms if the required flag is not set.
Comment #4
goldHaving just submitted this patch to add a blank option when a primary term is not required the client needed to have the blank option even when it is required to force the user to make a selection.
I've gone with schnippy's approach on this one though. The snippet above is almost right, missed the "taxonomy";
The actual check I used though was the following;
Comment #5
daddison commentedIf you're using the latest release for primary_term (6.x-1.2), then you need to leave out the 'taxonomy':
array_unshift($form['primaryterm']['#options'], ' -- Select a Term -- ');Also, you might need to make sure that your custom module executes after the primary_term module. I used the util module to set the weight of my custom module to 10. The default weight of the primary_term module is 9.