Posted by arhak on October 15, 2008 at 12:31am
Jump to:
| Project: | freelinking |
| Version: | 6.x-1.4 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Issue Summary
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:
<?php
'#default_value' => variable_get("freelinking_nodetype", 'story'),
?>should be:
<?php
$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:
<?php
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
#1
I like this idea, but could you please roll this into a patch?
#2
this 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)
#3
I am adapting this modification into 6.x-3.x-dev. Thank you arhak.