예제 #1
0
 /**
  * Provides propose forms for various RDF entities.
  *
  * This is used for the propose form of collections and solutions.
  *
  * @param \Drupal\rdf_entity\RdfEntityTypeInterface $rdf_type
  *   The RDF bundle entity for which to generate the propose form.
  *
  * @return array
  *   A render array for the propose form.
  *
  * @throws \Exception
  *   Thrown when an attempt is made to propose an rdf_entity that is not a
  *   solution or a collection.
  */
 public function proposeRdfEntity(RdfEntityTypeInterface $rdf_type)
 {
     $rdf_entity = $this->entityTypeManager()->getStorage('rdf_entity')->create(array('rid' => $rdf_type->id()));
     $form = $this->entityFormBuilder()->getForm($rdf_entity, 'propose');
     $form['#title'] = $this->t('Propose @type', ['@type' => Unicode::strtolower($rdf_type->label())]);
     return $form;
 }
예제 #2
0
 /**
  * Route title callback.
  *
  * @param \Drupal\rdf_entity\RdfEntityTypeInterface $rdf_type
  *   The rdf type.
  *
  * @return array
  *   The rdf type label as a render array.
  */
 public function rdfTypeTitle(RdfEntityTypeInterface $rdf_type)
 {
     return ['#markup' => $rdf_type->label(), '#allowed_tags' => Xss::getHtmlTagList()];
 }