Hi.

Just a thought for D8. I write a lot of modules and almost always I come across the same problem, for example:

taxonomy_get_vocabularies(type = NULL)...

I always have to re-write this in my own modules calling it

mymodule_get_vocabularies($types = NULL), and then change the db query to '...WHERE n.type IN ('.implode(',',$types).')...'

Isn't this a better way to deal with this, or am I missing something clever about these functions or how to use them? (I know I should take the implode out to the end and replace it with %s. Just keeping simple for sake of getting my point across).

Comments

Anonymous’s picture

Just to be clear, I do run the $types through something that adds quote marks on each side changing:

array('blog','page') to array('"blog"','"page"'), otherwise mysql gets terribly confused and starts crying.

marcingy’s picture

Status: Active » Closed (won't fix)