function EntityPermissionsForm::buildForm
Same name in other branches
- 10 core/modules/user/src/Form/EntityPermissionsForm.php \Drupal\user\Form\EntityPermissionsForm::buildForm()
- 11.x core/modules/user/src/Form/EntityPermissionsForm.php \Drupal\user\Form\EntityPermissionsForm::buildForm()
Builds the user permissions administration form for a bundle.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
string $bundle_entity_type: (optional) The entity type ID.
string|Drupal\Core\Entity\EntityInterface $bundle: (optional) Either the bundle name or the bundle object.
Overrides UserPermissionsForm::buildForm
File
-
core/
modules/ user/ src/ Form/ EntityPermissionsForm.php, line 122
Class
- EntityPermissionsForm
- Provides the permissions administration form for a bundle.
Namespace
Drupal\user\FormCode
public function buildForm(array $form, FormStateInterface $form_state, string $bundle_entity_type = NULL, $bundle = NULL) : array {
// Set $this->bundle for use by ::permissionsByProvider().
if ($bundle instanceof EntityInterface) {
$this->bundle = $bundle;
return parent::buildForm($form, $form_state);
}
$this->bundle = $this->entityTypeManager
->getStorage($bundle_entity_type)
->load($bundle);
return parent::buildForm($form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.