public static function RegistrantsElementUtility::entityCreateAccess in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/RegistrantsElementUtility.php \Drupal\rng\RegistrantsElementUtility::entityCreateAccess()
- 3.x src/RegistrantsElementUtility.php \Drupal\rng\RegistrantsElementUtility::entityCreateAccess()
Determine whether the current user can create new entities.
Parameters
string $entity_type_id: A entity type ID.
string $bundle: An entity bundle
Return value
boolean Whether the current user can create new entities.
2 calls to RegistrantsElementUtility::entityCreateAccess()
- Registrants::processIdentityElement in src/
Element/ Registrants.php - Process the registrant element.
- RegistrantsElementUtility::peopleTypeOptions in src/
RegistrantsElementUtility.php - Generate available people type options suitable for radios element.
File
- src/
RegistrantsElementUtility.php, line 417
Class
Namespace
Drupal\rngCode
public static function entityCreateAccess($entity_type_id, $bundle) {
$entity_type_manager = \Drupal::entityTypeManager();
$entity_type = $entity_type_manager
->getDefinition($entity_type_id);
$access_control = $entity_type_manager
->getAccessControlHandler($entity_type_id);
// If entity type has bundles
$entity_bundle = $entity_type
->getBundleEntityType() !== NULL ? $bundle : NULL;
return $access_control
->createAccess($entity_bundle);
}