Frontend\Modules\Location\Engine\Model::getMapSettings PHP Method

getMapSettings() public static method

Fetch all the settings for a specific map
public static getMapSettings ( integer $mapId ) : array
$mapId integer
return array
    public static function getMapSettings($mapId)
    {
        $mapSettings = (array) FrontendModel::getContainer()->get('database')->getPairs('SELECT s.name, s.value
             FROM location_settings AS s
             WHERE s.map_id = ?', array((int) $mapId));
        foreach ($mapSettings as $key => $value) {
            $mapSettings[$key] = unserialize($value);
        }
        return $mapSettings;
    }

Usage Example

Example #1
0
 /**
  * Load the data
  */
 protected function loadData()
 {
     $this->items = FrontendLocationModel::getAll();
     $this->settings = FrontendLocationModel::getMapSettings(0);
     $firstMarker = current($this->items);
     if (empty($this->settings)) {
         $this->settings = $this->get('fork.settings')->getForModule('Location');
         $this->settings['center']['lat'] = $firstMarker['lat'];
         $this->settings['center']['lng'] = $firstMarker['lng'];
     }
     // no center point given yet, use the first occurrence
     if (!isset($this->settings['center'])) {
         $this->settings['center']['lat'] = $firstMarker['lat'];
         $this->settings['center']['lng'] = $firstMarker['lng'];
     }
 }
All Usage Examples Of Frontend\Modules\Location\Engine\Model::getMapSettings