summaryrefslogtreecommitdiff
path: root/modules/node/node.module
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2003-03-08 14:35:42 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2003-03-08 14:35:42 +0000
commita0deb476faf8d35794c8e1286037ced22959bd07 (patch)
tree1ea62b601ba7538fd5ac19bae3e38ed367faffce /modules/node/node.module
parentb0859dcbd4f3b9b73ca8e43b73a248f17d81a80c (diff)
downloadbrdo-a0deb476faf8d35794c8e1286037ced22959bd07.tar.gz
brdo-a0deb476faf8d35794c8e1286037ced22959bd07.tar.bz2
- Changed _nodeapi("conf") to _nodeapi("settings").
- Changed node settings page to use table(). - Minor code beautification here and there.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r--modules/node/node.module36
1 files changed, 26 insertions, 10 deletions
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 = "<h3>" . t("Content settings") . "</h3>\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 .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n";
- $output .= "<tr><th>". t("Node") ."</th><th>\n";
- $output .= implode("</th><th>", array_keys(node_invoke_all($node, "nodeapi", "conf")));
- $output .= "</th></tr>\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 .= "<tr><td><p>$name</p></td><td align=\"center\">";
- $output .= implode("</td><td align=\"center\">", node_invoke_all($node, "nodeapi", "conf"));
- $output .= "</td></tr>\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 .= "<h2>". module_invoke($name, "node", "name") ."</h2>";
+ $output .= table($header, array($cols));
+ $output .= "<br /><br />";
}
}
- $output .= "</table><br />";
+ */
$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));