You are here

function icon_bundle_overview_form_submit in Icon API 7

Same name and namespace in other branches
  1. 8 includes/admin.inc \icon_bundle_overview_form_submit()

Submit callback for 'icon_bundle_overview_form'.

File

includes/admin.inc, line 107
admin.inc Provides administrative callbacks and tasks.

Code

function icon_bundle_overview_form_submit($form, $form_state) {
  $view_path_alias = $form_state['values']['icon_api_view_path_alias'];
  if ($form['global']['icon_api_view_path_alias']['#default_value'] !== $view_path_alias) {
    variable_set('icon_api_view_path_alias', $view_path_alias);
    if (!empty($view_path_alias)) {
      drupal_set_message(t('The view path alias, "%url", has been created for users with the %permission permission.', array(
        '%permission' => 'view icon',
        '%url' => base_path() . $view_path_alias,
      )));
    }
    else {
      drupal_set_message(t('The view path alias is disabled. Icons are now only viewable in the administrative area.'));
    }
    menu_rebuild();
  }
  if (isset($form_state['values']['icon_api_apache_suppress_warning'])) {
    variable_set('icon_api_apache_suppress_warning', $form_state['values']['icon_api_apache_suppress_warning']);

    // Remove message just set by building the form again.
    unset($_SESSION['messages']['warning']);
  }
  $bundles = icon_bundles();
  $saved_bundles = $form_state['values']['bundles'];
  foreach ($bundles as $name => $bundle) {
    if (!isset($saved_bundles[$name]['status'])) {
      continue;
    }
    $status = $saved_bundles[$name]['status'];
    if ($status !== $bundle['status']) {
      if ($status) {
        icon_bundle_enable($bundle);
      }
      else {
        icon_bundle_disable($bundle);
      }
    }
  }
}