function arrange_fields_display_main in Arrange Fields 6
Same name and namespace in other branches
- 7 arrange_fields.module \arrange_fields_display_main()
This is the "main menu" for arrange_fields. Simply displays a list of content types or webforms the user may arrange the fields of.
Return value
string
1 string reference to 'arrange_fields_display_main'
- arrange_fields_menu in ./
arrange_fields.module - Implementation of hook_menu().
File
- ./
arrange_fields.module, line 937
Code
function arrange_fields_display_main() {
$rtn = "";
drupal_add_css(drupal_get_path("module", "arrange_fields") . "/css/arrange_fields.css");
$rtn .= t("Select a content type to arrange fields") . "...\n <ul>";
foreach (node_get_types() as $type) {
// To eleminate confusion, let's not display the "webform" content type, if that module
// is installed.
if ($GLOBALS["arrange_fields_webform_installed"] && $type->type == "webform") {
continue;
}
$rtn .= "<li>" . l($type->name, "arrange-fields/{$type->type}") . "</li>";
}
$rtn .= "</ul>";
// If webform has been installed, attempt to use any available webforms as well.
if ($GLOBALS["arrange_fields_webform_installed"]) {
$rtn .= t("Select a webform to arrange fields") . "...\n <ul>";
$is_empty = TRUE;
$result = db_query("SELECT * FROM {node} WHERE type = 'webform'");
$nodes = array();
while ($node = db_fetch_object($result)) {
$nodes[] = $node;
$is_empty = FALSE;
}
if ($is_empty) {
$rtn .= "<li>" . t("No webforms have been created yet.") . "</li>";
}
else {
foreach ($nodes as $node_res) {
$rtn .= "<li>" . l($node_res->title, "arrange-fields/webform/{$node_res->nid}") . "</li>";
}
}
$rtn .= "</ul>";
}
// Does the user have any additional form_id's specified they'd like to try
// to arrange?
$other_form_ids = trim(variable_get("arrange_fields_other_form_ids", ""));
if ($other_form_ids != "") {
$temp = explode("\n", $other_form_ids);
$rtn .= t("Additional form_id's you specified on the Settings tab...");
$rtn .= "<ul>";
foreach ($temp as $form_id) {
$rtn .= "<li>" . l($form_id, "arrange-fields/other/{$form_id}") . "</li>";
}
$rtn .= "</ul>";
$rtn .= "<div class='arrange-fields-other-form-caveat'>";
$rtn .= t("Some caveats: Arrange Fields may not work correctly on forms\n with complex structures. Also, remember that some forms may\n appear differently depending on if you are admin, an authorized user,\n or an anonymous user (like user_register).\n If you need to arrange a form which only appears for anonymous users,\n temporarily grant anonymous users the \"administer\n arrange fields\" permission so you can arrange the form how it\n needs to look. Just be sure to take this away when you are done as\n it introduces a major security risk.");
$rtn .= "</div>";
}
return $rtn;
}