Sometimes it comes handy to have the name of the module that defined a node type. I modified a bit node_list so this is possible.

Comments

chx’s picture

chx’s picture

StatusFileSize
new1.16 KB
moshe weitzman’s picture

perhaps you missed the already existing node_get_module_name() function?

chx’s picture

Title: Deduce the module name from node type » Use any node type not just modulename-number
StatusFileSize
new2.19 KB

oh. I did. But then again, it artificially constrained the node types to modulename-number. I have not really known about this contraint, and see, it now serves as a good example of my patch.

killes@www.drop.org’s picture

+1

removes more code than it adds.

chx’s picture

StatusFileSize
new7.27 KB

Dries says

I'd remove the $pair parameter and fix the calling code to deal with it. [...] it makes for a simpler api

So, here we are.

dries’s picture

Status: Needs review » Active

Committed to HEAD. Change needs to be documented in the handbook.

asimmonds’s picture

The revised implementation of node_get_module_name() of this patch has different output to the previous version.

With modules that have multiple content types (eg project), node_get_module_name() would return the content type name (eg project_project or project_issue). This patch returns just the module name (eg project), which probably should be the correct result.

chx’s picture

Status: Active » Fixed

I documented the change in the handbook and no, node_get_module_name always returned the module name.

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)