Jelajahi Sumber

Add microblogtitle to config form

Andy Baugh 6 tahun lalu
induk
melakukan
86711191c4
2 mengubah file dengan 10 tambahan dan 5 penghapusan
  1. 1 0
      lib/tCMS/Config.inc
  2. 9 5
      templates/default/admin/settings.inc

+ 1 - 0
lib/tCMS/Config.inc

@@ -25,6 +25,7 @@
             'main'  => [
                 'home'  => [ 'label' => 'Default Home', 'default' => 'blog', 'form_field' => 'select', 'select_opts' => [ 'blog', 'microblog', 'fileshare' ] ],
                 'theme' => [ 'label' => 'tCMS Theme', 'default' => 'default', 'form_field' => 'select', 'select_opts' => [ 'default' ] ],
+                'microblogtitle' => [ 'label' => 'Microblog Title', 'default' => 'Microblog', 'form_field' => 'input', 'field_type' => 'text' ],
             ],
         ];
 

+ 9 - 5
templates/default/admin/settings.inc

@@ -10,15 +10,19 @@
         $model = $conf_obj->get_config_model('main');
         $line = '';
 
-        # For now there's no use to the 'form_field' setting, as main only uses select, user only inputs
         foreach ( $model as $key => $item ) {
             $line .= '<tr>';
             $line .= '<td><label for="' . $key . '">' . $item['label'] . '</label></td>';
-            $line .= '<td><select class="cooltext" name="' . $key . '" id="' . $key . '">';
-            foreach ( $item['select_opts'] as $option ) {
-                $line .= '<option value="' . $option . '">' . $option . '</option>';
+            if($item['form_field'] == 'select') {
+                $line .= '<td><select class="cooltext" name="' . $key . '" id="' . $key . '">';
+                foreach ( $item['select_opts'] as $option ) {
+                    $line .= '<option value="' . $option . '">' . $option . '</option>';
+                }
+                $line .= '</select></td>';
+            } elseif($item['form_field'] == 'input') {
+                $line .= '<td><input type="text" class="cooltext" name="' . $key . '" id="' . $key . '" placeholder="'.$item['default'].'" />';
             }
-            $line .= '</select></td></tr>';
+            $line .= '</tr>';
         }
         echo "$line\n";
     ?>