#78549 by beginner, test for function existence instead of module existence.

5.x
Neil Drumm 2006-08-15 05:09:49 +00:00
parent 937f9099b4
commit 8f1255a387
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ function node_overview_types() {
foreach ($names as $key => $name) {
$type = $types[$key];
if (module_exist($type->module)) {
if (function_exists($type->module .'_form')) {
$name = check_plain($name);
$type_url_str = str_replace('_', '-', $type->type);
// Populate the operations field.

View File

@ -1062,7 +1062,7 @@ function node_menu($may_cache) {
'type' => MENU_CALLBACK);
foreach (node_get_types() as $type) {
if (module_exist($type->module)) {
if (function_exists($type->module .'_form')) {
$name = check_plain($type->name);
$type_url_str = str_replace('_', '-', $type->type);
$items[] = array(
@ -2010,7 +2010,7 @@ function node_add($type) {
else {
// If no (valid) node type has been provided, display a node type overview.
foreach ($types as $type) {
if (module_exist($type->module) && node_access('create', $type->type)) {
if (function_exists($type->module .'_form') && node_access('create', $type->type)) {
$type_url_str = str_replace('_', '-', $type->type);
$title = t('Add a new %s.', array('%s' => check_plain($type->name)));
$out = '<dt>'. l($type->name, "node/add/$type_url_str", array('title' => $title)) .'</dt>';