{"action":"opened","issue":{"url":"https://api.github.com/repos/2amigos/yii2-leaflet-extension/issues/23","labels_url":"https://api.github.com/repos/2amigos/yii2-leaflet-extension/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/2amigos/yii2-leaflet-extension/issues/23/comments","events_url":"https://api.github.com/repos/2amigos/yii2-leaflet-extension/issues/23/events","html_url":"https://github.com/2amigos/yii2-leaflet-extension/issues/23","id":123288344,"number":23,"title":"Make it possible to omit the height CSS property from the inline CSS","user":{"login":"Okeanos","id":887496,"avatar_url":"https://avatars.githubusercontent.com/u/887496?v=3","gravatar_id":"","url":"https://api.github.com/users/Okeanos","html_url":"https://github.com/Okeanos","followers_url":"https://api.github.com/users/Okeanos/followers","following_url":"https://api.github.com/users/Okeanos/following{/other_user}","gists_url":"https://api.github.com/users/Okeanos/gists{/gist_id}","starred_url":"https://api.github.com/users/Okeanos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Okeanos/subscriptions","organizations_url":"https://api.github.com/users/Okeanos/orgs","repos_url":"https://api.github.com/users/Okeanos/repos","events_url":"https://api.github.com/users/Okeanos/events{/privacy}","received_events_url":"https://api.github.com/users/Okeanos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-21T14:25:47Z","updated_at":"2015-12-21T14:25:47Z","closed_at":null,"body":"The `Map` widget will currently inject a `height` CSS property with a value of `200px` into the output by default. The only possible setting here is to enter a different numerical value by providing it in the \r\n`echo $leaflet->widget(['height' => '500'])` call. Values are always interpreted as pixel values (`Map`, lines 60 and 64).\r\nThis makes it impossible to generate maps with a relative height or otherwise provide a height value with an external stylesheet by omitting the definition from the widget entirely.\r\n\r\nA possible solution would be to remove the `px` constant from the property, thus allowing different scales, and doing a `null` check before assigning the height to the style output and only assign it if any value has been set, thus allowing external height definitions for the widget.\r\n\r\n```php\r\nclass Map extends Widget {\r\n    // ...\r\n    public function init()\r\n    {\r\n        if ($inlineStyles) {\r\n            // remove any height properties from the inline styles to prevent duplicates in the result; $this->height takes precedent and will be used\r\n            $inlineStyles = preg_replace('/height\\:([ \\t])*\\d*\\w+;?/', '', $inlineStyles);\r\n            $styles = explode(';', $inlineStyles);\r\n            $styles[] = null !== $this->height ? \"height:{$this->height}\" : null;\r\n            $this->options['style'] = implode(\";\", array_filter($styles));\r\n        } else {\r\n            // @codeCoverageIgnoreStart\r\n            if(null !== $this->height) {\r\n                $this->options['style'] = \"height:{$this->height};\";\r\n            }\r\n            // @codeCoverageIgnoreEnd\r\n        }\r\n    }\r\n    // ..\r\n}\r\n```"}}