You are here

function calendar_clear_link_path in Calendar 7.3

Helper function to clear previously-set links to calendars.

Parameters

$path, Clear all links to this path. If NULL, clear all links.:

1 call to calendar_clear_link_path()
calendar_plugin_row::options_submit in includes/calendar_plugin_row.inc
Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.

File

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

Code

function calendar_clear_link_path($path = NULL) {
  $result = db_select('variable', 'v')
    ->fields('v', array(
    'name',
    'value',
  ))
    ->condition('name', 'calendar_date_link_%', 'LIKE')
    ->execute()
    ->fetchAll(PDO::FETCH_ASSOC);

  // Iterate over all the values and delete them.
  foreach ($result as $row) {
    if (empty($path) || unserialize($row['value']) == $path) {
      variable_del($row['name']);
    }
  }
  if (isset($_SESSION['calendar_links'][$path]['actions'])) {
    unset($_SESSION['calendar_links'][$path]['actions']);
    if (empty($_SESSION['calendar_links'][$path])) {
      unset($_SESSION['calendar_links'][$path]);
    }
  }
}