2020-05-29 13:41:58 +02:00
|
|
|
<?php
|
|
|
|
if (!is_array($fieldDesc)) {
|
|
|
|
$fieldDesc = array('info' => $fieldDesc);
|
|
|
|
$default = 'info';
|
|
|
|
} else {
|
|
|
|
if (!empty($field['options'])) {
|
|
|
|
if (isset($this->request->data[$modelForForm][$field['field']])) {
|
|
|
|
$default = $this->request->data[$modelForForm][$field['field']];
|
|
|
|
} else {
|
|
|
|
reset($field['options']);
|
|
|
|
$default = key($field['options']);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
reset($fieldDesc);
|
|
|
|
$fieldDesc = array('info' => key($fieldDesc));
|
|
|
|
$default = 'info';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo sprintf(
|
2021-09-17 13:04:37 +02:00
|
|
|
'<span id = "%sInfoPopover" class="icon-info-sign" data-bs-toggle="popover" data-bs-trigger="hover"></span>',
|
2020-05-29 13:41:58 +02:00
|
|
|
h($field['field'])
|
|
|
|
);
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
2021-09-17 17:51:45 +02:00
|
|
|
new bootstrap.Popover('#<?php echo h($field['field']); ?>InfoPopover', {
|
2020-05-29 13:41:58 +02:00
|
|
|
html: true,
|
|
|
|
content: function() {
|
|
|
|
var tempSelector = '#<?php echo h($modelForForm . \Cake\Utility\Inflector::camelize($field['field'])); ?>';
|
|
|
|
if ($(tempSelector)[0].nodeName === "SELECT" && Object.keys(fieldDesc).length > 1) {
|
|
|
|
return $('<div>').append(
|
|
|
|
$('<span>').attr('class', 'blue bold').text($(tempSelector +" option:selected").text())
|
|
|
|
).append(
|
|
|
|
$('<span>').text(': ' + fieldDesc[$(tempSelector).val()])
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return $('<div>').append(
|
|
|
|
$('<span>').attr('class', 'blue bold').text('<?php echo h(\Cake\Utility\Inflector::humanize($field['field'])); ?>')
|
|
|
|
).append(
|
|
|
|
$('<span>').text(": " + fieldDesc["info"])
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
var fieldDesc = <?php echo json_encode($fieldDesc); ?>;
|
|
|
|
});
|
|
|
|
</script>
|