ShortcutForm.php in Zircon Profile 8.0
Same filename and directory in other branches
Contains \Drupal\shortcut\ShortcutForm.
Namespace
Drupal\shortcutFile
core/modules/shortcut/src/ShortcutForm.phpView source
<?php
/**
* @file
* Contains \Drupal\shortcut\ShortcutForm.
*/
namespace Drupal\shortcut;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Form controller for the shortcut entity forms.
*/
class ShortcutForm extends ContentEntityForm {
/**
* The entity being used by this form.
*
* @var \Drupal\shortcut\ShortcutInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = $entity
->save();
if ($status == SAVED_UPDATED) {
$message = $this
->t('The shortcut %link has been updated.', array(
'%link' => $entity
->getTitle(),
));
}
else {
$message = $this
->t('Added a shortcut for %title.', array(
'%title' => $entity
->getTitle(),
));
}
drupal_set_message($message);
$form_state
->setRedirect('entity.shortcut_set.customize_form', array(
'shortcut_set' => $entity
->bundle(),
));
}
}
Classes
Name | Description |
---|---|
ShortcutForm | Form controller for the shortcut entity forms. |