DX: taxonomy_del_vocabulary/term -> taxonomy_delete_vocabulary/term
webchick - August 14, 2008 - 16:53
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | taxonomy.module |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
3 more characters are not going to kill anyone. This also makes it more consistent with for example user_delete() and node_delete().

#1
#2
My name is Morbus Iff, and I approve this patch.
#3
It'd be even more consistent if it was taxonomy_vocabulary_delete() / taxonomy_term_delete()
#4
that's not what i remember the comment for dpr saying...
but seriously, +1 for consistenly named functions.
#5
Catch: I'm not sure I agree. We have taxonomy_save_vocabulary(), not taxonomy_vocabulary_save(). Everything should be made consistent, certainly, and what you're suggesting would mean:
taxonomy_admin_(term|vocabulary)_edit > taxonomy_$1_edit (why is admin in there?)
taxonomy_del_(term|vocabulary) > taxonomy_$1_delete
taxonomy_form_(term|vocabulary)_(.*) > taxonomy_$1_form_$2
taxonomy_get_(term|vocabular(y|ies)) > taxonomy_$1_get*
taxonomy_get_term_by_name > taxonomy_term_by_name_get (sounds stupid)**
and so on, and so on (elementary exercise that I'm getting bored of).
And, ideally, there shouldn't be any use of "get" - it should be "load".
* A stronger approach, and a different issue, would let get_vocabulary support ints or arrays.
** A stronger approach, and a different issue, would be to turn by_name into a param to get_term.
#6
I was thinking of:
user_load
user_save
node_load
node_save
menu_rebuild
http://drupal.org/node/287877
All put the verb at the end, however, those are two word functions - so I'm fine if we standardise using the verb as the second word of the function. Also taxonomy_term_by_name_get sounds fine in Japanese ;)
#7
"All put the verb at the end", sure, but there's a corroborating rule: "all put the object at the beginning". The object is "taxonomy_vocabulary", and "taxonomy_term", not "taxonomy" (which means nothing).
#8
So, um, what's the consensus? Is it taxonomy_del_vocabulary/term to taxonomy_delete_vocabulary/term or taxonomy_del_vocabulary/term to taxonomy_vocabulary/term_delete?
#9
We already remaned taxonomy_get_term() to taxonomy_term_load() - which is what the menu system requires to use it as a proper loader. So I suggest we put the object at the beginning - but that "taxonomy vocabulary" and "taxonomy term" are the names of our objects for the purposes of function names at least.
Which would mean:
taxonomy_term_load
taxonomy_term_save
taxonomy_term_delete
taxonomy_vocabulary_load
taxonomy_vocabulary_save
taxonomy_vocabulary_delete
I've also opened another issue to standardise these on objects since they currently take all kinds of random stuff: #314147: DX: Standardise taxonomy load/save/delete functions on objects
#10
I agree with catch's restating of my opinion in #5 and #7.
#11
So, then I probably shouldn't be creating a patch here, since #314147 is likely to include this issue?
#12
Yep, let's duplicate this one in favour of #314147: DX: Standardise taxonomy load/save/delete functions on objects (although I was first, nyah! ;))