Security update for Core, with self-updated composer
[yaffs-website] / web / modules / contrib / fontyourface / src / Form / FontForm.php
1 <?php
2
3 namespace Drupal\fontyourface\Form;
4
5 use Drupal\Core\Entity\ContentEntityForm;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Form controller for Font edit forms.
10  *
11  * @ingroup fontyourface
12  */
13 class FontForm extends ContentEntityForm {
14
15   /**
16    * {@inheritdoc}
17    */
18   public function buildForm(array $form, FormStateInterface $form_state) {
19     /* @var $entity \Drupal\fontyourface\Entity\Font */
20     $form = parent::buildForm($form, $form_state);
21     $entity = $this->entity;
22
23     return $form;
24   }
25
26   /**
27    * {@inheritdoc}
28    */
29   public function save(array $form, FormStateInterface $form_state) {
30     $entity = $this->entity;
31     $status = parent::save($form, $form_state);
32
33     switch ($status) {
34       case SAVED_NEW:
35         drupal_set_message($this->t('Created the %label Font.', [
36           '%label' => $entity->label(),
37         ]));
38         break;
39
40       default:
41         drupal_set_message($this->t('Saved the %label Font.', [
42           '%label' => $entity->label(),
43         ]));
44     }
45     $form_state->setRedirect('entity.font.canonical', ['font' => $entity->id()]);
46   }
47
48 }