From a0deb476faf8d35794c8e1286037ced22959bd07 Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Sat, 8 Mar 2003 14:35:42 +0000 Subject: - Changed _nodeapi("conf") to _nodeapi("settings"). - Changed node settings page to use table(). - Minor code beautification here and there. --- modules/node/node.module | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'modules/node/node.module') diff --git a/modules/node/node.module b/modules/node/node.module index e8a583c55..1c7101039 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -548,22 +548,38 @@ function node_admin_settings($edit) { } } - $output = "

" . t("Content settings") . "

\n"; + $header = array_merge(array(t("Node")), array_keys(node_invoke_all($node, "nodeapi", "settings"))); + foreach (module_list() as $name) { + if (module_hook($name, "node")) { + $node->type = $name; + $cols = array(); + foreach (node_invoke_all($node, "nodeapi", "settings") as $setting) { + $cols[] = array("data" => $setting, "align" => "center", "width" => 55); + } + $rows[] = array_merge(array(module_invoke($name, "node", "name")), $cols); + } + } - $output .= "\n"; - $output .= "\n"; + $output = table($header, $rows); + /* This is an idea for the future. foreach (module_list() as $name) { if (module_hook($name, "node")) { $node->type = $name; - $output .= "\n"; + + // Create table() data: + $header = array_keys(node_invoke_all($node, "nodeapi", "settings")); + $cols = array(); + foreach (node_invoke_all($node, "nodeapi", "settings") as $setting) { + $cols[] = array("data" => $setting, "align" => "center", "width" => 75); + } + + $output .= "

". module_invoke($name, "node", "name") ."

"; + $output .= table($header, array($cols)); + $output .= "

"; } } - $output .= "
". t("Node") ."\n"; - $output .= implode("", array_keys(node_invoke_all($node, "nodeapi", "conf"))); - $output .= "

$name

"; - $output .= implode("", node_invoke_all($node, "nodeapi", "conf")); - $output .= "

"; + */ $output .= form_submit(t("Save configuration")); $output .= form_submit(t("Reset to defaults")); @@ -1346,7 +1362,7 @@ function node_update_index() { function node_nodeapi(&$node, $op, $arg = 0) { switch ($op) { - case "conf": + case "settings": $output[t("Publish")] = form_checkbox("", "node_status_$node->type", 1, variable_get("node_status_$node->type", 1)); $output[t("Promote")] = form_checkbox("", "node_promote_$node->type", 1, variable_get("node_promote_$node->type", 1)); $output[t("Static")] = form_checkbox("", "node_static_$node->type", 1, variable_get("node_static_$node->type", 0)); -- cgit v1.2.3