Several things in forum_form_alter():
1.
D7 regression - forum vocabulary could be deleted.
At admin/structure/taxonomy/forums/edit it says:
'This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'
This was true on D6. On D7, the form looks identical to the one for tags.
$form['delete']['#access'] = FALSE; should be $form['actions]['delete']['#access']
this appears to have no effect -- at least, as admin I can delete the forums vocab.
2.
Fieldset element for parents and weight been renamed to $form['relations']
in D6 it was $form['advanced'] see #10566-18: Forum can not appear in multiple containers
3.
Forum's vocabulary always has single hierarchy
comment added and 1 changed to TAXONOMY_HIERARCHY_SINGLE
$form['hierarchy'] = array('#type' => 'value', '#value' => 1);
This appears to come as a value anyway. Is the idea that the forum forces this in case a contrib module opens this up? If so, we need a code comment to explain it.
4. D7 only
if ($form_id == 'forum_node_form') {
Does this form even exist any more? I can't find that string anywhere else in the codebase, so it probably is.
Though this raises a question -- how do we prevent an admin use from removing the Forum vocab field from Forum posts?
| Comment | File | Size | Author |
|---|---|---|---|
| #48 | 787652-forum-form_alter-split-48.patch | 2.63 KB | andypost |
| #48 | 787652-forum-form_alter-FULL-split-48.patch | 4 KB | andypost |
| #45 | 787652-forum-form_alter-split_43.patch | 4.35 KB | andypost |
| #43 | 787652-forum-form_alter-split_43.patch | 4.35 KB | andypost |
| #37 | 787652-forum-form_alter-split_37.patch | 3.86 KB | larowlan |
Comments
Comment #1
joachim commentedFixing typo and making title a bit clearer.
Comment #2
andypostSeems reasonable and could be easily fixed. But first need UX attention
Comment #3
larowlanThere is an existing issue dealing with this. It's a bug in the form alter code, the form is has. changed so the vocabulary options are the same.
Re forum node form, that's from node_forms. The dup issue is #10566: Forum can not appear in multiple containers
Comment #4
andypostThis issues are different. Pointed issue should fix visibility of forum in multiple containers (multi-parented)
But this issue about all forum_form_alter() so let's not mix them.
Comment #5
andypostJust a tests
Comment #7
andypostA bit smarter tests, now we can be sure that fieldset has relations name in form definition
Comment #8
andypostIntroduced
hook_form_alter()split intoforum_form_taxonomy_form_vocabulary_alter()andforum_form_taxonomy_form_term_alter()for performance reasons.Not sure this split could be allowed for D7...
Comment #9
andypostUpdated issue summary for D8. patch with better comments
Comment #10
andypostFinally added @see to hooks doc block
Comment #11
andypostI don't think we should prevent ability to remove
forum's fieldfrom forum node typeComment #12
andypostD7 patch to test
Comment #14
andypostD7 has no TAXONOMY_HIERARCHY_* contants
Comment #15
andypostBack to 8.x
Comment #16
andypostThis could cause deletion of vocabulary
#10 - patch for D8
#14 - D7
Comment #17
larowlan#10: 787652-forum-form_alter-split.patch queued for re-testing.
Comment #18
larowlanComment #19
larowlanI think we should add a test that verifies this field exists as well, so if it is removed we don't end up with broken logic again.
Powered by Dreditor.
Comment #20
larowlanThis one without patch, to verify tests fail.
SHOULD FAIL.
Comment #21
larowlanComment #23
larowlanThis one adds test for vid field as per 19
Comment #25
larowlanhelps if I load the include...
Comment #26
andypostI think this is a over-engineering because if we are adding/editing vocabulary then vID field could be optional. For this purpose taxonomy_form_vocabulary() mentioned in @see
so if core would going to tremove primary key for vocabulary then we find this place
EDIT inline comments should end-up with comma
Comment #27
larowlanHey, the way I'm invoking it, vid should never be null (I'm passing $vocabulary).
Patch attached fixes inline comments and also changes assert from notNull to true.
Comment #29
larowlanWrong machine name
Comment #30
Niklas Fiekas commentedThis should be hook_form_FORM_ID_alter() for xyz(). See: http://drupal.org/node/1354#hookimpl.
Forums and containers have?
Another hook_form_FORM_ID_alter() implementation, as above.
Messages that are only used in tests shouldn't be translated. That means: Yes, do use
t('Save'), but don't use t() for'Save button found.'. The same thing goes for the other assertions.Comment #31
andypostLet's get one more opinions
suppose we should remove isset() so if once 'vid' would be removed this alter fails
this make this part useless
Comment #32
larowlanOK, anypost and I spoke on IRC about this and I realise the test I proposed at #19 is superfluous - other tests will fail if this field is removed upstream.
So this is the patch at #14 rerolled to take into account comments from #30 plus some other comment amendments.
Comment #33
Niklas Fiekas commentedExcellent :)
One minor point:
(And sorry, I could have made it clearer.) The @see is superflous now.
This one, too.
Comment #34
larowlanAll good
Comment #35
andypost+1 to RTBC, @larowlan thanx for fixing comments and grammar
Comment #36
Niklas Fiekas commentedUgg. Another tiny thing I missed. An empty line is supposed to be here. Leaving needs review for a real review.
Comment #37
larowlanNice catch
Comment #38
catchThis looks good to me, so I'm marking RTBC. I'll commit in a couple of days if no objections.
Comment #39
catchCommitted/pushed. Moving to 7.x for backport.
Comment #40
Tor Arne Thune commentedThis was reverted.
Comment #41
webchick#37: 787652-forum-form_alter-split_37.patch queued for re-testing.
Comment #43
andypostTesting profile used for test now has no Tags vocabulary
Comment #44
larowlanPatch seems to be mangled, can't view it, can you please reattach?
Weird that tests passed!
Comment #45
andypostSame patch
This looks very strange, I've seen this patch after upload and it was ok. Probably there's some troubles with d.o infra
Comment #46
larowlanThis one worked fine.
Comment #47
webchickOof. What a mess. :) Good catch!
Committed and pushed to 8.x. This needs a quick re-roll for D7, for the TAXONOMY_HIERARCHY_* stuff if nothing else.
Comment #48
andypostpatches for D7
787652-forum-form_alter-FULL-split-48.patch splits hook_form_alter to 3 hooks
787652-forum-form_alter-split-48.patch just fixes wrong keys
for performance reasons it's recommended to commit FULL patch because it's just a hook split
Let's leave it for @webchick to decide
EDIT: is D7 uses testing profile? Looks like Tags vocabulary is still created and used in tests.
Comment #50
andypost#48: 787652-forum-form_alter-FULL-split-48.patch queued for re-testing.
Comment #51
andypost@larowlan please review this
Comment #52
larowlan+1 for the FULL version but either are fine.
Comment #53
webchickI think it's fine to rename hook implementations. Committed and pushed the FULL patch 7.x for parity with 8.x. Thanks!
Comment #54.0
(not verified) commentedUpdated issue summary.