You are here

AssetForm.php in farmOS 2.x

Namespace

Drupal\asset\Form

File

modules/core/asset/src/Form/AssetForm.php
View source
<?php

namespace Drupal\asset\Form;

use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;

/**
 * Form controller for asset entities.
 *
 * @ingroup asset
 */
class AssetForm extends ContentEntityForm {

  /**
   * {@inheritdoc}
   */
  public function save(array $form, FormStateInterface $form_state) {
    parent::save($form, $form_state);
    $entity_url = $this->entity
      ->toUrl()
      ->setAbsolute()
      ->toString();
    $this
      ->messenger()
      ->addMessage($this
      ->t('Saved asset: <a href=":url">%label</a>', [
      ':url' => $entity_url,
      '%label' => $this->entity
        ->label(),
    ]));
    $form_state
      ->setRedirectUrl($this->entity
      ->toUrl());
  }

}

Classes

Namesort descending Description
AssetForm Form controller for asset entities.