source/php/Module/Location/Location.php
public function renderLocationList($post)
    {
        $api_url = get_field('event_api_url', 'option');
        $location_endpoint = rtrim($api_url, '/') . '/location/complete';
        @$json = file_get_contents($location_endpoint);

        if ($json == false) {
            $markup = '<em>' . __('Something went wrong, pleae check your API url.', 'event-integration') . '</em>';
        } else {
            $locations = json_decode($json);
            $location_data = get_field('mod_location_data', $post->ID);
            $current = ($location_data) ? $location_data->id : false;

            if (!empty($locations)) {
                $markup = '<select name="mod_location">';
                foreach ($locations as $location) {
                    $selected = ($current == $location->id) ? 'selected' : '';
                    $markup .= '<option value="' . $location->id . '" ' . $selected . '>' . $location->title . '</option>';
                }
                $markup .= '</select>';
            } else {
                $markup = '<em>' . __('No locations found', 'event-integration') . '</em>';
            }
        }

        echo $markup;
    }
public function renderLocationList($post)
    {
        $api_url = get_field('event_api_url', 'option');
        $location_endpoint = rtrim($api_url, '/') . '/location/complete';
        @$json = file_get_contents($location_endpoint);

        if ($json == false) {
            $markup = '<em>' . __('Something went wrong, pleae check your API url.', 'event-integration') . '</em>';
        } else {
            $locations = json_decode($json);
            $location_data = get_field('mod_location_data', $post->ID);
            $current = ($location_data) ? $location_data->id : false;

            if (!empty($locations)) {
                $markup = '<select name="mod_location">';
                foreach ($locations as $location) {
                    $selected = ($current == $location->id) ? 'selected' : '';
                    $markup .= '<option value="' . $location->id . '" ' . $selected . '>' . $location->title . '</option>';
                }
                $markup .= '</select>';
            } else {
                $markup = '<em>' . __('No locations found', 'event-integration') . '</em>';
            }
        }

        echo $markup;
    }
Display a list with location from API
@param  Obj $post Current post object
@return string Markup