Skip to content

Commit

Permalink
feat(datetimefield): default value
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jan 9, 2020
1 parent fe70b42 commit 120433f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions inc/fields/datetimefield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,40 @@ public function isPrerequisites() {
return true;
}

public function getDesignSpecializationField() {
$rand = mt_rand();

$label = '';
$field = '';

$additions = '<tr class="plugin_formcreator_question_specific">';
$additions .= '<td>';
$additions .= '<label for="dropdown_default_values'.$rand.'">';
$additions .= __('Default values');
$additions .= '</label>';
$additions .= '</td>';
$additions .= '<td>';
$value = Html::entities_deep($this->question->fields['default_values']);
$additions .= Html::showDateTimeField('default_values', ['value' => $value, 'display' => false]);
$additions .= '</td>';
$additions .= '<td>';
$additions .= '</td>';
$additions .= '<td>';
$additions .= '</td>';
$additions .= '</tr>';

$common = $common = parent::getDesignSpecializationField();
$additions .= $common['additions'];

return [
'label' => $label,
'field' => $field,
'additions' => $additions,
'may_be_empty' => false,
'may_be_required' => true,
];
}

public function getRenderedHtml($canEdit = true) {
if (!$canEdit) {
return $this->value;
Expand Down

0 comments on commit 120433f

Please sign in to comment.