You are here

function getlocations_blocks_block_save in Get Locations 7.2

Same name and namespace in other branches
  1. 7 modules/getlocations_blocks/getlocations_blocks.module \getlocations_blocks_block_save()

Implements hook_block_save().

This hook declares how the configured options for a block provided by this module are saved.

File

modules/getlocations_blocks/getlocations_blocks.module, line 277
getlocations_blocks.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

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

  // We need to save settings from the configuration form.
  // $delta contains the block name.
  $set = array();
  switch ($delta) {
    case 'getlocations_blocks_city':
      $set['city_path'] = $edit['getlocations_blocks_city_path'];
      $set['city_element'] = $edit['getlocations_blocks_city_element'];
      $set['city_filter'] = $edit['getlocations_blocks_city_filter'];
      if ($edit['getlocations_blocks_city_filter'] == 'field_name') {
        $set['city_filter_fieldname'] = $edit['getlocations_blocks_city_filter_fieldname'];
        $set['city_filter_bundle'] = '';
      }
      elseif ($edit['getlocations_blocks_city_filter'] == 'bundle') {
        $set['city_filter_fieldname'] = '';
        $set['city_filter_bundle'] = $edit['getlocations_blocks_city_filter_bundle'];
      }
      else {
        $set['city_filter_fieldname'] = '';
        $set['city_filter_bundle'] = '';
      }
      break;
    case 'getlocations_blocks_province':
      $set['province_path'] = $edit['getlocations_blocks_province_path'];
      $set['province_element'] = $edit['getlocations_blocks_province_element'];
      $set['province_filter'] = $edit['getlocations_blocks_province_filter'];
      if ($edit['getlocations_blocks_province_filter'] == 'field_name') {
        $set['province_filter_fieldname'] = $edit['getlocations_blocks_province_filter_fieldname'];
        $set['province_filter_bundle'] = '';
      }
      elseif ($edit['getlocations_blocks_province_filter'] == 'bundle') {
        $set['province_filter_fieldname'] = '';
        $set['province_filter_bundle'] = $edit['getlocations_blocks_province_filter_bundle'];
      }
      else {
        $set['province_filter_fieldname'] = '';
        $set['province_filter_bundle'] = '';
      }
      break;
    case 'getlocations_blocks_postalcode':
      $set['postalcode_path'] = $edit['getlocations_blocks_postalcode_path'];
      $set['postalcode_element'] = $edit['getlocations_blocks_postalcode_element'];
      $set['postalcode_filter'] = $edit['getlocations_blocks_postalcode_filter'];
      if ($edit['getlocations_blocks_postalcode_filter'] == 'field_name') {
        $set['postalcode_filter_fieldname'] = $edit['getlocations_blocks_postalcode_filter_fieldname'];
        $set['postalcode_filter_bundle'] = '';
      }
      elseif ($edit['getlocations_blocks_postalcode_filter'] == 'bundle') {
        $set['postalcode_filter_fieldname'] = '';
        $set['postalcode_filter_bundle'] = $edit['getlocations_blocks_postalcode_filter_bundle'];
      }
      else {
        $set['postalcode_filter_fieldname'] = '';
        $set['postalcode_filter_bundle'] = '';
      }
      break;
    case 'getlocations_blocks_country':
      $set['country_path'] = $edit['getlocations_blocks_country_path'];
      $set['country_element'] = $edit['getlocations_blocks_country_element'];
      $set['country_full'] = $edit['getlocations_blocks_country_full'];
      $set['country_filter'] = $edit['getlocations_blocks_country_filter'];
      if ($edit['getlocations_blocks_country_filter'] == 'field_name') {
        $set['country_filter_fieldname'] = $edit['getlocations_blocks_country_filter_fieldname'];
        $set['country_filter_bundle'] = '';
      }
      elseif ($edit['getlocations_blocks_country_filter'] == 'bundle') {
        $set['country_filter_fieldname'] = '';
        $set['country_filter_bundle'] = $edit['getlocations_blocks_country_filter_bundle'];
      }
      else {
        $set['country_filter_fieldname'] = '';
        $set['country_filter_bundle'] = '';
      }
      break;
  }
  if (count($set)) {
    getlocations_blocks_set_var($set);
  }
  return;
}