1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-21 21:21:54 +02:00

Snippet to include id attribute.

This commit is contained in:
Cameron 2020-12-23 08:35:31 -08:00
parent b5684da8d7
commit eb47eb7716
3 changed files with 5 additions and 3 deletions

View File

@ -2441,7 +2441,7 @@ class e_form
private function renderSnippet($snippet, $options, $name, $value)
{
$snip = $options;
$snip = (array) $options;
if(!empty($options['class']))
{
@ -2449,6 +2449,8 @@ class e_form
unset($options['class']);
}
$snip['id'] = $this->_format_id(varset($options['id']), $name, $value, null);
unset($options['id']);
$snip['attributes'] = $this->get_attributes($options, $name, $value);
foreach($snip as $k=>$v)

View File

@ -1148,7 +1148,7 @@ class e_formTest extends \Codeception\Test\Unit
$result = $this->_frm->checkbox('myname', 3, true, ['readonly'=>true]);
$expected = "<label class='checkbox form-check'>
<input class='form-check-input' type='checkbox' id='myname-3' readonly='readonly' checked='checked' />
<input id='myname-3' class='form-check-input' type='checkbox' readonly='readonly' checked='checked' />
<span></span>
</label>";

View File

@ -1,4 +1,4 @@
<label class='checkbox form-check'>
<input class='{class}' type='checkbox' {attributes} />
<input id='{id}' class='{class}' type='checkbox' {attributes} />
<span>{label}</span>
</label>