You are here

function calendar_remove in Calendar 6.2

Same name and namespace in other branches
  1. 7 calendar.module \calendar_remove()
  2. 7.2 calendar.module \calendar_remove()

Callback to remove a default calendar from the system.

File

./calendar.module, line 530
Adds calendar filtering and displays to Views.

Code

function calendar_remove($view_name) {

  // Remove any variable that creates a default view with this name.
  $calendar_options = variable_get('calendar_default_view_options', array());
  if (array_key_exists($view_name, $calendar_options)) {
    unset($calendar_options[$view_name]);
  }
  variable_set('calendar_default_view_options', $calendar_options);

  // Delete it from the database, if stored there.
  if ($view = views_get_view($view_name)) {
    $view
      ->delete();
  }
  views_invalidate_cache();
}