You are here

function wunderground_weather_block_save in Wunderground weather 7

Implements hook_block_save().

File

./wunderground_weather.module, line 359
Wunderground weather module to display weather forecasts and current weather conditions in blocks.

Code

function wunderground_weather_block_save($delta = '', $edit = array()) {

  // Save wunderground_weather settings.
  foreach ($edit as $key => $value) {
    if (substr($key, 0, 20) === 'wunderground_weather') {
      variable_set($key, $value);
    }
  }
  $block_fields = array();
  foreach ($edit['fields'] as $key => $field) {
    $block_fields[$key] = array(
      '#enabled' => check_plain($field['enabled']),
      '#weight' => check_plain($field['weight']),
    );
    variable_set($delta . '_fields', serialize($block_fields));
  }

  // @todo Clear specific cache entries.
  cache_clear_all('*', 'cache', TRUE);
}