/** * Handles access to the rdf_entity proposal form. * * @param \Drupal\rdf_entity\RdfEntityTypeInterface $rdf_type * The RDF entity type for which the proposal form is built. * * @return \Drupal\Core\Access\AccessResult * The access result object. */ public function createAssetReleaseAccess(RdfEntityTypeInterface $rdf_type) { if (!in_array($rdf_type->id(), ['collection', 'solution'])) { return AccessResult::forbidden(); } return AccessResult::allowedIf($this->currentUser()->hasPermission("propose {$rdf_type->id()} rdf entity")); }
/** * Provides the RDF submission form. * * @param \Drupal\rdf_entity\RdfEntityTypeInterface $rdf_type * The RDF bundle entity for the RDF entity. * * @return array * A RDF submission form. */ public function add(RdfEntityTypeInterface $rdf_type) { $rdf_entity = $this->entityTypeManager()->getStorage('rdf_entity')->create(array('rid' => $rdf_type->id())); $form = $this->entityFormBuilder()->getForm($rdf_entity, 'add'); return $form; }