public function OpenlayersObjects::edit_execute_form in Openlayers 7.3
Implements ctools_export_ui::edit_execute_form().
This is hacky, but since CTools Export UI uses drupal_goto() we have to effectively change the plugin to modify the redirect path dynamically.
Overrides ctools_export_ui::edit_execute_form
File
- modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersObjects.php, line 161 - Class openlayers_objects_ui.
Class
- OpenlayersObjects
- Class openlayers_objects_ui.
Code
public function edit_execute_form(&$form_state) {
$output = parent::edit_execute_form($form_state);
if (!empty($form_state['executed'])) {
if ($form_state['clicked_button']['#name'] == 'saveandedit') {
// We always want to redirect back to this page when adding an item,
// but we want to preserve the destination so we can be redirected back
// to where we came from after clicking "Save".
$options = array();
if (!empty($_GET['destination'])) {
$options['query']['destination'] = $_GET['destination'];
unset($_GET['destination']);
}
// Sets redirect path and options.
$op = $form_state['op'];
$path = 'add' != $op ? current_path() : 'admin/structure/openlayers/' . $this->plugin['menu']['menu item'] . '/list/' . $form_state['item']->machine_name . '/edit/start';
$this->plugin['redirect'][$op] = array(
$path,
$options,
);
}
}
return $output;
}