You are here

public function FieldController::manageRedirect in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 src/Controller/FieldController.php \Drupal\ds\Controller\FieldController::manageRedirect()
  2. 8.3 src/Controller/FieldController.php \Drupal\ds\Controller\FieldController::manageRedirect()

Redirect to the correct manage callback.

1 string reference to 'FieldController::manageRedirect'
ds.routing.yml in ./ds.routing.yml
ds.routing.yml

File

src/Controller/FieldController.php, line 121

Class

FieldController
Route controller fields.

Namespace

Drupal\ds\Controller

Code

public function manageRedirect($field_key) {
  $config = $this
    ->config('ds.field.' . $field_key);
  if ($field = $config
    ->get()) {
    $url = new Url('ds.manage_' . $field['type'] . '_field', array(
      'field_key' => $field_key,
    ));
    if ($url
      ->toString()) {
      return new RedirectResponse($url
        ->toString());
    }
  }
  drupal_set_message($this
    ->t('Field not found'));
  $url = new Url('ds.fields_list');
  return new RedirectResponse($url
    ->toString());
}