Angeltype: Only show defined contact infos

This commit is contained in:
Igor Scheller 2021-12-09 11:20:14 +01:00 committed by msquare
parent 6c288bceb5
commit 39f83ef082
1 changed files with 13 additions and 5 deletions

View File

@ -476,11 +476,19 @@ function AngelType_view_info(
*/
function AngelTypes_render_contact_info($angeltype)
{
return heading(__('Contact'), 3) . description([
__('Name') => $angeltype['contact_name'],
__('DECT') => sprintf('<a href="tel:%s">%1$s</a>', $angeltype['contact_dect']),
__('E-Mail') => sprintf('<a href="mailto:%s">%1$s</a>', $angeltype['contact_email']),
]);
$info = [
__('Name') => [$angeltype['contact_name'], $angeltype['contact_name']],
__('DECT') => [sprintf('<a href="tel:%s">%1$s</a>', $angeltype['contact_dect']), $angeltype['contact_dect']],
__('E-Mail') => [sprintf('<a href="mailto:%s">%1$s</a>', $angeltype['contact_email']), $angeltype['contact_email']],
];
$contactInfo = [];
foreach ($info as $name => $data) {
if (!empty($data[1])) {
$contactInfo[$name] = $data[0];
}
}
return heading(__('Contact'), 3) . description($contactInfo);
}
/**