Commit f796b122 authored by webchick's avatar webchick

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) {
if ($destinations) {
$destination = drupal_get_destination();
$destinations[] = $destination['destination'];
unset($_GET['destination']);
$this->getRequest()->query->remove('destination');
$path = array_shift($destinations);
$options = drupal_parse_url($path);
$options['query']['destinations'] = $destinations;
......
......@@ -7,6 +7,8 @@
namespace Drupal\field_ui;
use Symfony\Component\HttpFoundation\Request;
/**
* Static service container wrapper for Field UI.
*/
......@@ -18,11 +20,11 @@ class FieldUI {
* @return array
* An array of redirect paths.
*/
public static function getNextDestination() {
public static function getNextDestination(Request $request) {
$next_destination = array();
$destinations = !empty($_REQUEST['destinations']) ? $_REQUEST['destinations'] : array();
$destinations = $request->query->get('destinations');
if (!empty($destinations)) {
unset($_REQUEST['destinations']);
$request->query->remove('destinations');
$path = array_shift($destinations);
$options = drupal_parse_url($path);
if ($destinations) {
......
......@@ -206,7 +206,7 @@ public function submitForm(array &$form, array &$form_state) {
try {
$field->save();
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)) {
$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) {
*/
public function delete(array &$form, array &$form_state) {
$destination = array();
if (isset($_GET['destination'])) {
$request = $this->getRequest();
if ($request->query->has('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));
}
......@@ -234,7 +235,7 @@ protected function getFieldItems(EntityInterface $entity, $field_name) {
* Either the next path, or an array of redirect paths.
*/
protected function getNextDestination() {
$next_destination = FieldUI::getNextDestination();
$next_destination = FieldUI::getNextDestination($this->getRequest());
if (empty($next_destination)) {
$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