* Addressbook - Allow multiselection for customfield added to link title

This commit is contained in:
nathangray 2018-08-08 09:18:23 -06:00
parent 8f99f175aa
commit 3c5b7c8ba5
2 changed files with 7 additions and 3 deletions

View File

@ -181,7 +181,7 @@ class addressbook_hooks
if (($cf_opts = Api\Contacts::cf_options()))
{
$settings['link_title_cf'] = array(
'type' => 'select',
'type' => 'multiselect',
'label' => 'Add a customfield to link title',
'name' => 'link_title_cf',
'values' => $cf_opts,

View File

@ -1494,9 +1494,13 @@ class Contacts extends Contacts\Storage
$type = null;
}
$title = $this->fileas($contact,$type);
if ($this->prefs['link_title_cf'] && $contact['#'.$this->prefs['link_title_cf']])
$field_list = is_string($this->prefs['link_title_cf']) ? explode(',', $this->prefs['link_title_cf']) : $this->prefs['link_title_cf'];
foreach ($field_list as $field)
{
$title .= ' ' . $contact['#'.$this->prefs['link_title_cf']];
if($contact['#'.$field])
{
$title .= ', ' . $contact['#'.$field];
}
}
return $title ;
}