Beispiel #1
0
 private static function getValues(\contact\Resource\ContactInfo $contact_info, $sort_social = false)
 {
     $values['phone_number'] = $contact_info->getPhoneNumber();
     $values['fax_number'] = $contact_info->getFaxNumber();
     $values['email'] = $contact_info->getEmail();
     $values['formatted_phone_number'] = $contact_info->getPhoneNumber(true);
     if ($values['fax_number']) {
         $values['formatted_fax_number'] = $contact_info->getFaxNumber(true);
     }
     $physical_address = $contact_info->getPhysicalAddress();
     $map = $contact_info->getMap();
     $values = array_merge($values, ContactInfo\PhysicalAddress::getValues($physical_address));
     $values = array_merge($values, ContactInfo\Map::getValues($map));
     if ($sort_social) {
         $social = ContactInfo\Social::getLinks();
         foreach ($social as $label => $link) {
             if (isset($link['url'])) {
                 $social_icons[$label] = $link;
             }
         }
         if (!empty($social_icons)) {
             $values = array_merge($values, array('social' => $social_icons));
         }
     } else {
         $values = array_merge($values, array('social' => ContactInfo\Social::getLinks()));
     }
     return $values;
 }
Beispiel #2
0
 public static function post(\contact\Resource\ContactInfo $contact_info, $values)
 {
     $contact_info->setPhoneNumber($values['phone_number']);
     $contact_info->setFaxNumber($values['fax_number']);
     $contact_info->setEmail($values['email']);
     self::save($contact_info);
     $physical_address = $contact_info->getPhysicalAddress();
     Factory\ContactInfo\PhysicalAddress::set($physical_address, $values);
     Factory\ContactInfo\PhysicalAddress::save($physical_address);
 }