feat: gestione tel e mailto per le tabelle datatables

This commit is contained in:
MatteoPistorello 2024-10-31 15:11:40 +01:00
parent 438c10ab08
commit 0b1e4d764e
2 changed files with 15 additions and 1 deletions

View File

@ -177,8 +177,18 @@ if (!empty($query)) {
$column['data-color'] = isset($column['data-color']) ? $column['data-color'] : color_inverse(trim($column['data-background']));
}
elseif (preg_match('/^mailto_(.+?)$/', trim($field), $m)) {
$column['class'] = '';
$value = ($r[$field] ? '<a class="btn btn-default btn-sm btn-block" style="font-weight:normal;" href="mailto:'.$r[$field].'" target="_blank"><i class="fa fa-envelope text-primary"></i> '.$r[$field].'</a>' : '');
}
elseif (preg_match('/^tel_(.+?)$/', trim($field), $m)) {
$column['class'] = '';
$value = ($r[$field] ? '<a class="btn btn-default btn-sm btn-block" href="tel:'.$r[$field].'" target="_blank"><i class="fa fa-phone text-primary"></i> '.$r[$field].'</a>' : '');
}
// Link della colonna
if ($field != '_print_') {
if ($field != '_print_' && !preg_match('/^tel_(.+?)$/', trim($field), $m) && !preg_match('/^mailto_(.+?)$/', trim($field), $m)) {
$id_record = $r['id'];
$hash = '';

View File

@ -128,6 +128,10 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') {
$attr_td .= " width='30'";
$name = str_replace('icon_', 'icon_title_', $name);
$field = str_replace('icon_', '', $field);
} elseif (preg_match('/^mailto_/', (string) $field)) {
$field = str_replace('mailto_', '', $field);
} elseif (preg_match('/^tel_/', (string) $field)) {
$field = str_replace('tel_', '', $field);
}
if (isMobile()) {