Guest User

Untitled

a guest
May 27th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.92 KB | None | 0 0
  1. $result = $query->execute();
  2.     if (!empty($result['node'])) {
  3.       $result = entity_load('node', array_keys($result['node']));
  4.     }
  5.  
  6.     $items = array('data' => array(), 'tag' => 'Event');
  7.  
  8.     foreach ($result as $event) {
  9.       $logo = NULL;
  10.       if (isset($event->field_logo[LANGUAGE_NONE][0]['fid'])) {
  11.         $logo = file_load($event->field_logo[LANGUAGE_NONE][0]['fid']);
  12.       }
  13.       $items['data'][] = array(
  14.         'data' => array(
  15.           'SiteId' => '', // @todo: replace with real value
  16.           'OriginatorKey' => '', // @todo: replace with real value
  17.           'State' => '', // @todo: replace with real value
  18.           'ResortId' => '', // @todo: replace with real value
  19.           'PlaceName' => '', // @todo: replace with real value
  20.           'Locality' => '', // @todo: replace with real value
  21.           'Street' => '', // @todo: replace with real value
  22.           'LangCode' => $lang,
  23.           'Title' => array(
  24.             'data' => $event->title_field[$lang][0]['value'],
  25.             'attributes' => array('language' => $lang),
  26.           ),
  27.           'Description' => array(
  28.             'data' => '',
  29.             'attributes' => array('language' => $lang),
  30.           ),
  31.           'AddInfo' => array(
  32.             'data' => $event->field_additional_information[$lang][0]['safe_value'],
  33.             'attributes' => array('language' => $lang),
  34.           ),
  35.           'Category' => '', // @todo: replace with real value
  36.           'SubCategory' => '', // @todo: replace with real value
  37.           'PriceFrom' => $event->field_price_range[$lang][0]['min'],
  38.           'PriceTo' => $event->field_price_range[$lang][0]['max'],
  39.           'ReservationPossible' => '', // @todo: replace with real value
  40.           'ProspectusAvailable' => '', // @todo: replace with real value
  41.           'AddressInfo' => '', // @todo: replace with real value
  42.           'AddressAddInfo' => '', // @todo: replace with real value
  43.           'Phone' => '', // @todo: replace with real value
  44.           'Fax' => '', // @todo: replace with real value
  45.           'Url' => '', // @todo: replace with real value
  46.           'Email' => '', // @todo: replace with real value
  47.           'FreeField1' => '', // @todo: replace with real value
  48.           'FreeField2' => '', // @todo: replace with real value
  49.           'X' => '', // @todo: replace with real value
  50.           'Y' => '', // @todo: replace with real value
  51.           'Picture' => '', // @todo: replace with real value
  52.           'EveryYear' => '', // @todo: replace with real value
  53.           'Dates' => array(
  54.             'data' => array(
  55.               'DateFrom' => '',
  56.               'TimeFrom' => $event->field_time[$lang][0]['max'],
  57.               'TimeTo' => '',
  58.             )
  59.           ),
  60.           'Creator' => '', // @todo: replace with real value
  61.           'CreationDate' => date('d.m.Y H:m', $event->created)
  62.         ),
  63.       );
  64.     }
  65.     // return data.
  66.     return $items;
  67.   }
Add Comment
Please, Sign In to add comment