Skip to content

Commit c2e360e

Browse files
committed
fix(form): have default values for color and icon
1 parent 8d97354 commit c2e360e

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

inc/common.class.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public static function getEnumValues($table, $field) {
4343
$type = $data['Type'];
4444
$matches = null;
4545
preg_match("/^enum\(\'(.*)\'\)$/", $type, $matches);
46+
if (!isset($matches[1])) {
47+
return [];
48+
}
4649
$enum = explode("','", $matches[1]);
4750
}
4851

inc/form.class.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,15 @@ public function showForm($ID, $options = []) {
369369
echo '<tr class="tab_bg_1">';
370370
echo '<td>' . __('Form icon', 'formcreator') . '</td>';
371371
echo '<td>';
372-
PluginFormcreatorCommon::showFontAwesomeDropdown('icon', ['value' => $this->fields['icon']]);
373-
Html::showColorField('icon_color', ['value' => $this->fields['icon_color']]);
372+
$icon = $this->fields['icon'] == '' ? 'fa fa-question-circle' : $this->fields['icon'];
373+
PluginFormcreatorCommon::showFontAwesomeDropdown('icon', ['value' => $icon]);
374+
$iconColor = $this->fields['icon_color'] == '' ? '#999999' : $this->fields['icon_color'];
375+
Html::showColorField('icon_color', ['value' => $iconColor]);
374376
echo '</td>';
375377
echo '<td>' . __('Background color', 'formcreator') . '</td>';
376378
echo '<td>';
377-
Html::showColorField('background_color', ['value' => $this->fields['background_color']]);
379+
$tileColor = $this->fields['background_color'] == '' ? '#E7E7E7' : $this->fields['background_color'];
380+
Html::showColorField('background_color', ['value' => $tileColor]);
378381
echo '</td>';
379382
echo '</tr>';
380383

js/scripts.js.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ function buildTiles(list) {
401401
}
402402

403403
if (item.icon_color == '') {
404-
item.icon_color = '#000000';
404+
item.icon_color = '#999999';
405405
}
406406

407407
if (item.type == 'form') {

0 commit comments

Comments
 (0)