/** * Controller for the base form. * * We need to override the functionality of the create form for pages * that include the rdf_entity id in the url so that the og audience field * is auto completed. * * @param \Drupal\rdf_entity\RdfInterface $rdf_entity * The collection rdf_entity. * * @return array * Return the form array to be rendered. */ public function add(RdfInterface $rdf_entity) { // Setup the values for the release. $values = ['rid' => 'asset_release', 'field_isr_is_version_of' => $rdf_entity->id()]; foreach ($this->fieldsToCopy as $solution_field => $release_field) { if (!empty($rdf_entity->get($solution_field)->getValue())) { $values[$release_field] = $rdf_entity->get($solution_field)->getValue(); } } $asset_release = $this->entityTypeManager()->getStorage('rdf_entity')->create($values); $form = $this->entityFormBuilder()->getForm($asset_release); return $form; }