You are here

function mostpopular_block_save in Drupal Most Popular 7

Implements hook_block_save().

Parameters

unknown_type $delta:

unknown_type $values:

File

./mostpopular.module, line 746
The main file for the Most Popular module.

Code

function mostpopular_block_save($block, $values = array()) {
  if (!is_object($block)) {
    $block = mostpopular_blocks($block);
  }
  if ($block) {
    if (isset($values['mostpopular'])) {
      $values = $values['mostpopular'];
    }
    foreach ($values as $key => $value) {
      if (is_array($value)) {
        $data =& $block->{$key};
        foreach ($value as $k => $v) {
          $data[$k] = $v;
        }
      }
      else {
        $block->{$key} = $value;
      }
    }
    _mostpopular_save('block', $block);
  }
}