src/Sulu/Bundle/ContactBundle/Controller/ContactController.php
private function addAvatars($contacts, $locale)
    {
        $ids = array_filter(array_column($contacts, 'avatar'));
        $avatars = $this->get('sulu_media.media_manager')->getFormatUrls($ids, $locale);
        foreach ($contacts as $key => $contact) {
            if (array_key_exists('avatar', $contact)
                && $contact['avatar']
                && array_key_exists($contact['avatar'], $avatars)
            ) {
                $contacts[$key]['avatar'] = $avatars[$contact['avatar']];
            }
        }

        return $contacts;
    }
private function addAvatars($contacts, $locale)
    {
        $ids = array_filter(array_column($contacts, 'avatar'));
        $avatars = $this->get('sulu_media.media_manager')->getFormatUrls($ids, $locale);
        foreach ($contacts as $key => $contact) {
            if (array_key_exists('avatar', $contact)
                && $contact['avatar']
                && array_key_exists($contact['avatar'], $avatars)
            ) {
                $contacts[$key]['avatar'] = $avatars[$contact['avatar']];
            }
        }

        return $contacts;
    }
private function addAvatars ( $ contacts , $ locale ) { $ ids = array_filter ( array_column ( $ contacts , 'avatar' ) ) ; $ avatars = $ this -> get ( 'sulu_media.media_manager' ) -> getFormatUrls ( $ ids , $ locale ) ; foreach ( $ contacts as $ key => $ contact ) { if ( array_key_exists ( 'avatar' , $ contact ) && $ contact [ 'avatar' ] && array_key_exists ( $ contact [ 'avatar' ] , $ avatars ) ) { $ contacts [ $ key ] [ 'avatar' ] = $ avatars [ $ contact [ 'avatar' ] ] ; } } return $ contacts ; }
Takes an array of contacts and resets the avatar containing the media id with
the actual urls to the avatars thumbnail.

@param array $contacts
@param string $locale

@return array
Takes an array of contacts and resets the avatar containing the media id with the actual urls to the avatars thumbnail .