Example #1
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     /* @var $entity \Drupal\rdf_entity\Entity\Rdf */
     $form = parent::buildForm($form, $form_state);
     $entity = $this->entity;
     $type = RdfEntityType::load($entity->bundle());
     if ($type->label()) {
         // Add.
         if ($entity->isNew()) {
             $form['#title'] = $this->t('<em>Add @type</em>', array('@type' => $type->label()));
         } else {
             $form['#title'] = $this->t('<em>Edit @type</em> @title', array('@type' => $type->label(), '@title' => $entity->label()));
         }
     }
     $form['langcode'] = array('#title' => $this->t('Language'), '#type' => 'language_select', '#default_value' => $entity->getUntranslated()->language()->getId(), '#languages' => Language::STATE_ALL);
     return $form;
 }