You are here

function datex_block_save in Datex 7.3

Implements hook_block_save().

File

./datex.module, line 133
Datex main module file, Datex adds php-intl support to drupal.

Code

function datex_block_save($delta = '', $edit = []) {
  $b = variable_get('datex_block', []);
  for ($i = 0; $i < variable_get('datex_block_count', 1); $i++) {
    if ($delta === "datex_block_{$i}") {
      $b[$i]['cal'] = $edit['datex_calendar'];
      $b[$i]['fmt'] = $edit['datex_format'];
      $b[$i]['tz'] = $edit['datex_timezone'];
      $b[$i]['text'] = strpos($edit['datex_text'], '{}') < 0 ? '{}' : $edit['datex_text'];
      if (strpos($edit['datex_text'], '{}') < 0) {
        drupal_set_message(t('Invalid content, content set to {}'), 'warning');
      }
      break;
    }
  }
  variable_set('datex_block', $b);
}