You are here

function calendar_clear_link_bundle in Calendar 7.3

Helper function to clear previously-set links to calendars.

Parameters

$bundle, Clear all links for this bundle. If NULL, clear all links.:

File

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

Code

function calendar_clear_link_bundle($bundle = NULL) {
  if (empty($bundle)) {
    $result = db_select('variable', 'v')
      ->fields('v', 'name')
      ->condition('name', 'calendar_date_link_%', 'LIKE')
      ->execute()
      ->fetchAll(PDO::FETCH_ASSOC);
  }
  else {
    $result = db_select('variable', 'v')
      ->fields('v', 'name')
      ->condition('name', 'calendar_date_link_' . $bundle)
      ->execute()
      ->fetchAll(PDO::FETCH_ASSOC);
  }

  // Iterate over all the values and delete them.
  foreach ($result as $row) {
    variable_del($row['name']);
  }
}