/** * Get access editing form. * * @param \stdClass $objectAcl Acl object with data. * @param Role $currentRole Role object. * * @return CoreForm */ protected function _getForm($objectAcl, $currentRole) { $form = new CoreForm(); if (!empty($objectAcl->actions)) { $form->addHtml('header_actions', '<h4>' . $this->di->get('i18n')->_('Actions') . '</h4>'); foreach ($objectAcl->actions as $action) { $form->addCheckbox($action, ucfirst($action), sprintf('ACTION_%s_%s_DESCRIPTION', strtoupper(str_replace('\\', '_', $objectAcl->name)), strtoupper($action)), 1, $this->core->acl()->isAllowed($currentRole->name, $objectAcl->name, $action), 0); } } if (!empty($objectAcl->options)) { $form->addHtml('header_options', '<br/><br/><h4>' . $this->di->get('i18n')->_('Options') . '</h4>'); foreach ($objectAcl->options as $option) { $form->addText($option, ucfirst($option), sprintf('OPTION_%s_%s_DESCRIPTION', strtoupper(str_replace('\\', '_', $objectAcl->name)), strtoupper($option)), $this->core->acl()->getAllowedValue($objectAcl->name, $currentRole, $option)); } } $form->addFooterFieldSet()->addButton('save')->addButtonLink('cancel', 'Cancel', ['for' => 'admin-access']); return $form; }