diff --git a/radar.inc.php b/radar.inc.php index 24be12f..a0e00ba 100644 --- a/radar.inc.php +++ b/radar.inc.php @@ -29,7 +29,10 @@ function radar_retrieve_events($settings) { return $events; } -function radar_retrieve_entities(array $entities) { +function radar_retrieve_entities($entities) { + if (!is_array($entities)) { + $entities = [$entities]; + } $client = radar_client(); return $client->retrieveEntityMultiple($entities); } @@ -147,7 +150,7 @@ function _radar_method_lookup($type, $field) { 'date' => 'getDates', 'body' => 'getBody', 'url' => 'getUrlView', - 'image' => 'getImageRaw', + 'image' => 'getImage', 'price' => 'getPrice', 'price_category' => 'getPriceCategory', 'email' => 'getEmail', @@ -187,7 +190,13 @@ function _radar_method_lookup($type, $field) { 'link' => 'getLink', 'phone' => 'getPhone', 'opening_times' => 'getOpeningTimes', - ) + ), + 'image' => array( + 'title' => 'getTitle', + 'mime' => 'getMime', + 'url' => 'getUrl', + 'size' => 'getSize', + ), ); return !empty($lookup[$type][$field]) ? $lookup[$type][$field] : FALSE; } diff --git a/radar.php b/radar.php index 0ad9312..09fe817 100644 --- a/radar.php +++ b/radar.php @@ -41,6 +41,7 @@ function radar_shortcode_events($attributes, $content = '') { 'price_category:title', 'price', 'link', + 'image:url', 'body', 'group:title', 'group:url', @@ -193,6 +194,18 @@ function radar_shortcode_field_url_value($field, $type, $item, $parents, $shortc } add_filter('radar_shortcode_field_value', 'radar_shortcode_field_url_value', 12, 5); +/** + * Format image. + */ +function radar_shortcode_image_value($field, $type, $item, $parents, $shortcode) { + if ($type == 'image' && $field['field'] == 'url' && $field['value']) { + $field['output'] = ''; + } + + return $field; +} +add_filter('radar_shortcode_field_value', 'radar_shortcode_image_value', 12, 5); + // // 'radar_shortcode_field_html' //