Fixes #14368: Added role attribute for active radio list

This commit is contained in:
Evgeniy Moiseenko
2018-09-17 02:26:42 +03:00
committed by Alexander Makarov
parent 1816219067
commit f7862c16c7
3 changed files with 29 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.16 under development
------------------------
- Bug #14368: Added `role` attribute for active radio list (s1lver)
- Bug #16680: Fixed ActiveField 'text' input with maxlength (s1lver)
- Bug #5341: HasMany via two relations (shirase, cebe)
- Bug #16558: Added cloning `yii\data\ActiveDataProvider::query` property when ActiveDataProvider object is cloned (mgrechanik)

View File

@ -728,6 +728,7 @@ class ActiveField extends Component
$this->addErrorClassIfNeeded($options);
}
$this->addRoleAttributes($options, 'radiogroup');
$this->addAriaAttributes($options);
$this->adjustLabelFor($options);
$this->_skipLabelFor = true;
@ -923,6 +924,19 @@ class ActiveField extends Component
}
}
/**
* Add role attributes to the input options
* @param $options array input options
* @param string $role
* @since 2.0.16
*/
protected function addRoleAttributes(&$options, $role)
{
if (!isset($options['role'])) {
$options['role'] = $role;
}
}
/**
* Adds validation class to the input options if needed.
* @param $options array input options