{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/9126","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/9126/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/9126/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/9126/events","html_url":"https://github.com/yiisoft/yii2/issues/9126","id":95375711,"number":9126,"title":"Add Html::div to HtmlHelper","user":{"login":"dynasource","id":125726,"avatar_url":"https://avatars.githubusercontent.com/u/125726?v=3","gravatar_id":"","url":"https://api.github.com/users/dynasource","html_url":"https://github.com/dynasource","followers_url":"https://api.github.com/users/dynasource/followers","following_url":"https://api.github.com/users/dynasource/following{/other_user}","gists_url":"https://api.github.com/users/dynasource/gists{/gist_id}","starred_url":"https://api.github.com/users/dynasource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dynasource/subscriptions","organizations_url":"https://api.github.com/users/dynasource/orgs","repos_url":"https://api.github.com/users/dynasource/repos","events_url":"https://api.github.com/users/dynasource/events{/privacy}","received_events_url":"https://api.github.com/users/dynasource/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-16T08:04:49Z","updated_at":"2015-07-16T08:23:26Z","closed_at":"2015-07-16T08:23:26Z","body":"Currently Html::img & Html::a are supported in the HtmlHelper because of their unique characteristics. \r\n\r\nOn the other hand you could assume that these are supported because of their widely use.\r\n\r\nWhat is happening in practice, is that I often automatically want to try Html::div() to render a container,. But this should be done by Html::tag('div'), which 'feels' not autonomically yet for such a widely used element. It also is less readible in the code.\r\n\r\nI would suggest to include a shortcut to DIV in the Html Helper. For several reasons:\r\n* more intuitive\r\n* faster code to read (especially within widgets)\r\n* shorter code to write\r\n\r\nExample:\r\n```php\r\n        $body[] = Html::tag('div',$img,$this->imageOptions);\r\n        $body[] = Html::tag('div',$body,$this->bodyOptions);\r\n        return Html::tag('div',implode($body),$this->options);\r\n```\r\n\r\n```php        \r\n        $body[] = Html::div($img,$this->imageOptions);\r\n        $body[] = Html::div($body,$this->bodyOptions);\r\n        return Html::div(implode($body),$this->options);   \r\n```"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/121875566","html_url":"https://github.com/yiisoft/yii2/issues/9126#issuecomment-121875566","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/9126","id":121875566,"user":{"login":"klimov-paul","id":1482054,"avatar_url":"https://avatars.githubusercontent.com/u/1482054?v=3","gravatar_id":"","url":"https://api.github.com/users/klimov-paul","html_url":"https://github.com/klimov-paul","followers_url":"https://api.github.com/users/klimov-paul/followers","following_url":"https://api.github.com/users/klimov-paul/following{/other_user}","gists_url":"https://api.github.com/users/klimov-paul/gists{/gist_id}","starred_url":"https://api.github.com/users/klimov-paul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klimov-paul/subscriptions","organizations_url":"https://api.github.com/users/klimov-paul/orgs","repos_url":"https://api.github.com/users/klimov-paul/repos","events_url":"https://api.github.com/users/klimov-paul/events{/privacy}","received_events_url":"https://api.github.com/users/klimov-paul/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T08:23:26Z","updated_at":"2015-07-16T08:23:26Z","body":"`Html::img` and `Html::a` have been extracted because the y use different function API: `img` should always have an \"src\" attribute and `a` - a \"href\" attribute.\r\n\r\nUsing `Html` helper for the general markup composition is a bad practice - you should use plain HTML for your containers."}}