Browse Source

Add media save redirect.

pull/971/head
Rosie Le Faive 1 year ago
parent
commit
fdfdd87472
  1. 15
      islandora.module

15
islandora.module

@ -332,6 +332,7 @@ function islandora_form_alter(&$form, FormStateInterface $form_state, $form_id)
if ($node) {
$form['name']['widget'][0]['value']['#default_value'] = $node->getTitle();
}
$form['actions']['submit']['#submit'][] = 'islandora_media_custom_form_submit';
}
}
@ -387,6 +388,20 @@ function islandora_form_alter(&$form, FormStateInterface $form_state, $form_id)
return $form;
}
/**
* Redirect submit handler for media save.
*/
function islandora_media_custom_form_submit(&$form, FormStateInterface $form_state) {
$params = \Drupal::request()->query->all();
if (!empty($params)) {
$target_id = $params['edit']['field_media_of']['widget'][0]['target_id'];
$url = Url::fromRoute('entity.node.canonical', ['node' => $target_id]);
$form_state->setRedirectUrl($url);
}
}
/**
* Implements a submit handler for the delete form.
*/

Loading…
Cancel
Save