Пример #1
0
 public static function form_content($content_type, $nid = 0)
 {
     $content_type = content_database::load_node_type($content_type);
     if ($nid != 0) {
     } else {
         page::title("add new %node", array("%node" => $content_type->name));
     }
     $form = array();
     $form['action'] = page::url("node/adding/" . $content_type->type);
     $form['fields'] = array();
     if ($content_type->has_title) {
         $form['fields']['title'] = array("type" => "input", "label" => "title");
     }
     if ($content_type->has_body) {
         $form['fields']['body'] = array("type" => "text", "label" => "Body");
     }
     foreach ($content_type->fields as $field) {
         $fname = $field['field_machine_name'];
         $form["fields"][$fname] = array("label" => $field['field_name']);
         switch ($field["field_type"]) {
             case "TEXT" || "text":
                 $form["fields"][$fname]["type"] = "text";
                 break;
         }
     }
     $form["fields"]["submit"] = array("type" => "submit", "value" => "save");
     return theme::t_form($form);
 }
Пример #2
0
 public static function login_block()
 {
     return theme::t_form(self::login_form_ui(array()));
 }