RoleForm: Force a suffix for all element names

fixes #4973
This commit is contained in:
Johannes Meyer 2023-05-26 15:03:02 +02:00
parent 5000d3117b
commit c40cfb41a8
1 changed files with 6 additions and 1 deletions

View File

@ -55,6 +55,11 @@ class RoleForm extends RepositoryForm
return Filter::where('name', $this->getIdentifier()); return Filter::where('name', $this->getIdentifier());
} }
public function filterName($value, $allowBrackets = false)
{
return parent::filterName($value, $allowBrackets) . '_element';
}
public function createInsertElements(array $formData = array()) public function createInsertElements(array $formData = array())
{ {
$this->addElement( $this->addElement(
@ -156,7 +161,7 @@ class RoleForm extends RepositoryForm
if (! isset($spec['isFullPerm']) if (! isset($spec['isFullPerm'])
&& substr($name, 0, strlen(self::DENY_PREFIX)) !== self::DENY_PREFIX && substr($name, 0, strlen(self::DENY_PREFIX)) !== self::DENY_PREFIX
) { ) {
$denyCheckbox = $this->createElement('checkbox', self::DENY_PREFIX . $name, [ $denyCheckbox = $this->createElement('checkbox', $this->filterName(self::DENY_PREFIX . $name), [
'decorators' => ['ViewHelper'] 'decorators' => ['ViewHelper']
]); ]);
$this->addElement($denyCheckbox); $this->addElement($denyCheckbox);