You are here

function responsive_preview_device_delete_form_submit in Responsive Theme Preview 7

Form submission handler for responsive_preview_device_delete_form().

Parameters

$form: An associative array containing the structure of the form.

$form_state: An associative array containing the current state of the form.

See also

responsive_preview_device_delete_form()

File

./responsive_preview.admin.inc, line 295
Administrative page callbacks for the responsive_preview module.

Code

function responsive_preview_device_delete_form_submit($form, &$form_state) {
  $name = $form_state['values']['name'];
  $devices = responsive_preview_get_device_definition();
  $label = $devices[$name]['label'];
  try {
    db_delete('responsive_preview')
      ->condition('name', $form_state['values']['name'])
      ->execute();
  } catch (Exception $e) {
    watchdog_exception('responsive_preview', $e);
    throw $e;
  }
  cache_clear_all('responsive_preview', 'cache', TRUE);
  drupal_set_message(t('Device :label has been deleted.', array(
    ':label' => $label,
  )));
  $form_state['redirect'] = 'admin/config/content/responsive-preview';
}