Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
taxonomy_save_term(), apart from not having standardised naming (see #295392: DX: taxonomy_del_vocabulary/term -> taxonomy_delete_vocabulary/term) - also takes $form_values as argument, whereas it ought to be an API function taking an object independent of the forms system - as brought up by Crell on #306224: EOL Taxonomy sprint: add proper taxonomy term hooks.
So, we should pass it an object instead. Patch forthcoming in the next couple of days.
Comment | File | Size | Author |
---|---|---|---|
#9 | whoops_with_a_test.patch | 4.23 KB | catch |
#8 | whoops_with_a_test.patch | 4.23 KB | catch |
#7 | whoops_with_a_test.patch | 4.1 KB | catch |
#5 | whoops.patch | 2.86 KB | catch |
#3 | term_objects.patch | 15.05 KB | catch |
Comments
Comment #1
webchickSubscriiiiiibe.
Also labeling DX.
Comment #2
catchHere's a patch.
I'm doing a cast to object in case taxonomy_term_save() is passed an array. I'd like to get rid of this, but this means rewriting 90% of the existing taxonomy term tests (same for vocabulary which needs the same treatment). I can do that here, but ideally it belongs in a different issue. Also drupal_write_record() casts to array internally as well, so I dunno if we might want to leave it as a helper along those lines.
Comment #3
catchFollowing pwolanin's improvements to #329140: Make vocabulary load/insert/update/save like terms, here's the same for taxonomy terms. taxonomy_term_save() can no longer be used to delete a term - apparently this wasn't used anywhere in core, but still...
Comment #4
Dries CreditAttribution: Dries commentedAlso committed this patch. Please update the docs! :)
Comment #5
catchI missed a couple of cast to objects, and one typo made it through. Found this when saving new terms from the node form - so we need a test for that, and taxonomy.test is a real mess in general.
Comment #6
Dries CreditAttribution: Dries commentedLet's add a test! We should set the right example. Thanks catch. :)
Comment #7
catchHere it is with a test :)
Comment #8
catchadded code comments and whitespace changes.
Comment #9
catchand fixed a typo that appears to have become unfixed in one of the revisions.
Comment #10
webchickCommitted, thanks!
Comment #11
catchBack to needs work for docs.
Also byproduct of dbtng conversion was this bug (also not tested, but now it is) #332145: UNSTABLE-3 blocker: taxonomy_form_term_submit passes empty string as parent [dbtng conversion regression].
Comment #12
catchAdded documentation http://drupal.org/node/224333#term_functions
Comment #14
salvisThe committed patch in #3 has an undesired side effect. I've opened a new issue: #850690: Regression: Set the tid of the newly created forum or container