diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php index ba6af78..b5e5528 100644 --- a/core/modules/shortcut/src/Entity/Shortcut.php +++ b/core/modules/shortcut/src/Entity/Shortcut.php @@ -26,9 +26,8 @@ * handlers = { * "access" = "Drupal\shortcut\ShortcutAccessControlHandler", * "form" = { - * "default" = "Drupal\shortcut\ShortcutForm", - * "add" = "Drupal\shortcut\ShortcutForm", - * "edit" = "Drupal\shortcut\ShortcutForm", + * "default" = "Drupal\shortcut\Form\ShortcutEditForm", + * "add" = "Drupal\shortcut\Form\ShortcutAddForm", * "delete" = "Drupal\shortcut\Form\ShortcutDeleteForm" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" diff --git a/core/modules/shortcut/src/Form/ShortcutAddForm.php b/core/modules/shortcut/src/Form/ShortcutAddForm.php new file mode 100644 index 0000000..c1ab83c --- /dev/null +++ b/core/modules/shortcut/src/Form/ShortcutAddForm.php @@ -0,0 +1,38 @@ +entity; + $entity->save(); + + $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())); + } + +} \ No newline at end of file diff --git a/core/modules/shortcut/src/Form/ShortcutEditForm.php b/core/modules/shortcut/src/Form/ShortcutEditForm.php new file mode 100644 index 0000000..8ea3e5f --- /dev/null +++ b/core/modules/shortcut/src/Form/ShortcutEditForm.php @@ -0,0 +1,38 @@ +entity; + $entity->save(); + + $message = $this->t('The shortcut %link has been updated.', array('%link' => $entity->getTitle())); + drupal_set_message($message); + + $form_state->setRedirect('entity.shortcut_set.customize_form', array('shortcut_set' => $entity->bundle())); + } + +} \ No newline at end of file diff --git a/core/modules/shortcut/src/ShortcutForm.php b/core/modules/shortcut/src/ShortcutForm.php deleted file mode 100644 index f2f16e9..0000000 --- a/core/modules/shortcut/src/ShortcutForm.php +++ /dev/null @@ -1,46 +0,0 @@ -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()) - ); - } - -}