Commit f796b122 authored by webchick's avatar webchick
Browse files

Issue #1999346 by kim.pepper, atchijov, John Bickar, piyuesh23, dawehner,...

Issue #1999346 by kim.pepper, atchijov, John Bickar, piyuesh23, dawehner, effulgentsia: Use Symfony Request for fieldui module.
parent 9fb534bb
...@@ -473,7 +473,7 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -473,7 +473,7 @@ public function submitForm(array &$form, array &$form_state) {
if ($destinations) { if ($destinations) {
$destination = drupal_get_destination(); $destination = drupal_get_destination();
$destinations[] = $destination['destination']; $destinations[] = $destination['destination'];
unset($_GET['destination']); $this->getRequest()->query->remove('destination');
$path = array_shift($destinations); $path = array_shift($destinations);
$options = drupal_parse_url($path); $options = drupal_parse_url($path);
$options['query']['destinations'] = $destinations; $options['query']['destinations'] = $destinations;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
namespace Drupal\field_ui; namespace Drupal\field_ui;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Static service container wrapper for Field UI. * Static service container wrapper for Field UI.
*/ */
...@@ -18,11 +20,11 @@ class FieldUI { ...@@ -18,11 +20,11 @@ class FieldUI {
* @return array * @return array
* An array of redirect paths. * An array of redirect paths.
*/ */
public static function getNextDestination() { public static function getNextDestination(Request $request) {
$next_destination = array(); $next_destination = array();
$destinations = !empty($_REQUEST['destinations']) ? $_REQUEST['destinations'] : array(); $destinations = $request->query->get('destinations');
if (!empty($destinations)) { if (!empty($destinations)) {
unset($_REQUEST['destinations']); $request->query->remove('destinations');
$path = array_shift($destinations); $path = array_shift($destinations);
$options = drupal_parse_url($path); $options = drupal_parse_url($path);
if ($destinations) { if ($destinations) {
......
...@@ -206,7 +206,7 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -206,7 +206,7 @@ public function submitForm(array &$form, array &$form_state) {
try { try {
$field->save(); $field->save();
drupal_set_message($this->t('Updated field %label field settings.', array('%label' => $this->instance->label()))); drupal_set_message($this->t('Updated field %label field settings.', array('%label' => $this->instance->label())));
$next_destination = FieldUI::getNextDestination(); $next_destination = FieldUI::getNextDestination($this->getRequest());
if (empty($next_destination)) { if (empty($next_destination)) {
$next_destination = $this->entityManager->getAdminPath($this->instance->entity_type, $this->instance->bundle) . '/fields'; $next_destination = $this->entityManager->getAdminPath($this->instance->entity_type, $this->instance->bundle) . '/fields';
} }
......
...@@ -198,9 +198,10 @@ public function submitForm(array &$form, array &$form_state) { ...@@ -198,9 +198,10 @@ public function submitForm(array &$form, array &$form_state) {
*/ */
public function delete(array &$form, array &$form_state) { public function delete(array &$form, array &$form_state) {
$destination = array(); $destination = array();
if (isset($_GET['destination'])) { $request = $this->getRequest();
if ($request->query->has('destination')) {
$destination = drupal_get_destination(); $destination = drupal_get_destination();
unset($_GET['destination']); $request->query->remove('destination');
} }
$form_state['redirect'] = array('admin/structure/types/manage/' . $this->instance['bundle'] . '/fields/' . $this->instance->id() . '/delete', array('query' => $destination)); $form_state['redirect'] = array('admin/structure/types/manage/' . $this->instance['bundle'] . '/fields/' . $this->instance->id() . '/delete', array('query' => $destination));
} }
...@@ -234,7 +235,7 @@ protected function getFieldItems(EntityInterface $entity, $field_name) { ...@@ -234,7 +235,7 @@ protected function getFieldItems(EntityInterface $entity, $field_name) {
* Either the next path, or an array of redirect paths. * Either the next path, or an array of redirect paths.
*/ */
protected function getNextDestination() { protected function getNextDestination() {
$next_destination = FieldUI::getNextDestination(); $next_destination = FieldUI::getNextDestination($this->getRequest());
if (empty($next_destination)) { if (empty($next_destination)) {
$next_destination = $this->entityManager->getAdminPath($this->instance->entity_type, $this->instance->bundle) . '/fields'; $next_destination = $this->entityManager->getAdminPath($this->instance->entity_type, $this->instance->bundle) . '/fields';
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment