the content type story might not exist (even more on custom installation profiles)
but normally the content type could be removed from the content types
so .module line 137:
'#default_value' => variable_get("freelinking_nodetype", 'story'),
should be:
$default_type = variable_get('freelinking_nodetype', NULL);
//avoid look for a suitable type when isn't needed
if (empty($default_type)) {
$default_type = _wfk_find_suitable_default_type();
}
...
'#default_value' => $default_type,
and:
function _wfk_find_suitable_default_type() {
$types = node_get_types('types');
$default_type = $types[0]->type; //just in case we have to give up (there has to be at least ONE or else really give up)
//avoid giving up with page content type
if ($default_type == 'page' && count($types) > 1) {
$default_type = $types[1]->type;
}
foreach($types as $type) {
if ($type->type == 'wiki') {
$default_type = $type->type;
break;
} elseif($type->type == 'story') {
$default_type = $type->type;
} elseif($default_type != 'story') {
if ($type->type == 'blog') {
$default_type = $type->type;
}
}
}
return $default_type;
}
Comments
Comment #1
eafarris commentedI like this idea, but could you please roll this into a patch?
Comment #2
arhak commentedthis project doesn't seems to be maintained, is it?
are you a maintainer of this module?
would like to discuss some ideas and contribute some draft code
since I like this module but is so... I think it has to be rethought and refactored (huge refactor)
Comment #3
Grayside commentedI am adapting this modification into 6.x-3.x-dev. Thank you arhak.
Comment #4
juampynr commentedClosing. This was fixed by dynamically picking the first content type available.