Skip to content

Commit

Permalink
Добавлена возможность указывать атрибуты для полей modal2
Browse files Browse the repository at this point in the history
  • Loading branch information
n2ref committed Sep 1, 2023
1 parent b2339d7 commit 662c988
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion html/material/edit/modal2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<input type="hidden" id="[KEY]" name="[NAME]" value="[VALUE]">
<div class="input-group">
<input id="[KEY]-title" class="modal-control-title form-control input-sm first"
value="[TEXT]" type="text" disabled="disabled">
value="[TEXT]" type="text" disabled="disabled" [ATTR]>
<!-- BEGIN clear -->
<button type="button" class="modal-control-clear btn btn-default add-on middle" onclick="edit.modal2.clear('[KEY]');">
<img src="[THEME_DIR]/img/clear.png" alt="Очистить" title="Очистить">
Expand Down
20 changes: 11 additions & 9 deletions inc/classes/class.edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -742,15 +742,16 @@ public function makeTable() {
} else {
$this->scripts['modal2'] = true;

$options = [];
$options['size'] = isset($value['in']['size']) ? $value['in']['size'] : '';
$options['title'] = isset($value['in']['title']) ? $value['in']['title'] : '';
$options['text'] = isset($value['in']['text']) ? htmlspecialchars($value['in']['text']) : '';
$options['value'] = isset($value['in']['value']) ? $value['in']['value'] : $value['default'];
$options['url'] = isset($value['in']['url']) ? $value['in']['url'] : '';
$options['onHidden'] = isset($value['in']['onHidden']) ? $value['in']['onHidden'] : '';
$options['onClear'] = isset($value['in']['onClear']) ? $value['in']['onClear'] : '';
$options['onChoose'] = isset($value['in']['onChoose']) ? $value['in']['onChoose'] : '';
$options = [];
$options['size'] = $value['in']['size'] ?? '';
$options['title'] = $value['in']['title'] ?? '';
$options['text'] = isset($value['in']['text']) ? htmlspecialchars($value['in']['text']) : '';
$options['value'] = $value['in']['value'] ?? $value['default'];
$options['attributes'] = $value['in']['attributes'] ?? '';
$options['url'] = $value['in']['url'] ?? '';
$options['onHidden'] = $value['in']['onHidden'] ?? '';
$options['onClear'] = $value['in']['onClear'] ?? '';
$options['onChoose'] = $value['in']['onChoose'] ?? '';

switch ($options['size']) {
case 'xl': $size = 'modal-xl'; break;
Expand All @@ -773,6 +774,7 @@ public function makeTable() {
$tpl->assign('[URL]', $url);
$tpl->assign('[NAME]', 'control[' . $field . ']');
$tpl->assign('[SIZE]', $size);
$tpl->assign('[ATTR]', $options['attributes']);
$tpl->assign('[KEY]', crc32(uniqid() . microtime(true)));


Expand Down

0 comments on commit 662c988

Please sign in to comment.