Browse Source

Removing duplicate helper function

pull/754/head
dannylamb 6 years ago
parent
commit
0ecb51c551
  1. 25
      src/Form/AddMediaForm.php

25
src/Form/AddMediaForm.php

@ -334,29 +334,4 @@ class AddMediaForm extends FormBase {
return AccessResult::forbidden();
}
/**
* Utility function to check if user can create 'Islandora' entity types.
*/
protected function canCreateIslandoraEntity($entity_type, $bundle_type) {
$bundles = $this->entityTypeManager->getStorage($bundle_type)->loadMultiple();
$access_control_handler = $this->entityTypeManager->getAccessControlHandler($entity_type);
$allowed = [];
foreach (array_keys($bundles) as $bundle) {
// Skip bundles that aren't 'Islandora' types.
if (!$this->utils->isIslandoraType($entity_type, $bundle)) {
continue;
}
$access = $access_control_handler->createAccess($bundle, NULL, [], TRUE);
if (!$access->isAllowed()) {
continue;
}
return TRUE;
}
return FALSE;
}
}

Loading…
Cancel
Save