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
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

webchick - August 14, 2008 - 16:53
Title:taxonomy_del_vocabulary/term -> taxonomy_delete_vocabulary/term» DX: taxonomy_del_vocabulary/term -> taxonomy_delete_vocabulary/term

#2

Morbus Iff - August 14, 2008 - 16:59

My name is Morbus Iff, and I approve this patch.

#3

catch - August 14, 2008 - 16:59

It'd be even more consistent if it was taxonomy_vocabulary_delete() / taxonomy_term_delete()

#4

neclimdul - August 14, 2008 - 17:03

that's not what i remember the comment for dpr saying...

but seriously, +1 for consistenly named functions.

#5

Morbus Iff - August 14, 2008 - 17:06

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

catch - August 14, 2008 - 17:15

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

Morbus Iff - August 14, 2008 - 17:16

"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

oadaeh - September 27, 2008 - 06:05

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

catch - September 27, 2008 - 09:10

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

Morbus Iff - September 27, 2008 - 13:09

I agree with catch's restating of my opinion in #5 and #7.

#11

oadaeh - September 27, 2008 - 13:25

So, then I probably shouldn't be creating a patch here, since #314147 is likely to include this issue?

#12

webchick - September 27, 2008 - 16:56
Status:active» duplicate

Yep, let's duplicate this one in favour of #314147: DX: Standardise taxonomy load/save/delete functions on objects (although I was first, nyah! ;))

 
 

Drupal is a registered trademark of Dries Buytaert.