Skip to content
Permalink
Browse files

3956 entity clean up (#3957)

* Add new arguments key and target. Make it possible use not only default target for db connections

* Replace drupal_set_message with messenger service

* Fix label
  • Loading branch information...
LOBsTerr committed Apr 6, 2019
1 parent 0ca9d6a commit 09114aa40b607ae745e31fb9f3061b33cf46be94
Showing with 4 additions and 11 deletions.
  1. +4 −11 templates/module/src/Entity/Form/entity-content.php.twig
@@ -66,18 +66,11 @@ class {{ entity_class }}Form extends ContentEntityForm {% endblock %}

$status = parent::save($form, $form_state);

switch ($status) {
case SAVED_NEW:
\Drupal::messenger()->addMessage($this->t('Created the %label {{ label }}.', [
'%label' => $entity->label(),
]));
break;
$this->messenger()->addMessage($this->t('%action the %label {{ label }}.', [
'%action' => $status == SAVED_NEW ? 'Created' : 'Saved',
'%label' => $entity->label(),
]));

default:
\Drupal::messenger()->addMessage($this->t('Saved the %label {{ label }}.', [
'%label' => $entity->label(),
]));
}
$form_state->setRedirect('entity.{{ entity_name }}.canonical', ['{{ entity_name }}' => $entity->id()]);
}
{% endblock %}

0 comments on commit 09114aa

Please sign in to comment.
You can’t perform that action at this time.