You are here

function yandex_metrics_block_save in Yandex.Metrics 7

Implements hook_block_save().

File

./yandex_metrics.module, line 150
The main code of Yandex.Metrics module.

Code

function yandex_metrics_block_save($delta = '', $edit = array()) {
  if ($delta == 'popular_content') {
    variable_set('yandex_metrics_popular_content_links_count', $edit['yandex_metrics_popular_content_links_count']);
    $previous_date_period = variable_get('yandex_metrics_popular_content_date_period', 'week');
    $new_date_period = $edit['yandex_metrics_popular_content_date_period'];

    // Update already saved Popular content data if the date period has been changed.
    if ($previous_date_period != $new_date_period) {
      variable_set('yandex_metrics_popular_content_date_period', $new_date_period);
      yandex_metrics_save_popular_content();
    }
  }
}