Comments

duellj’s picture

Status: Active » Needs review
StatusFileSize
new2.17 KB

Attached is a patch that transforms numeric block deltas to strings. For some reason, my comments are being appended by ";". Am I inserting them wrong?

Test block function:

function example_block($op, $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks[0] = array(
        'info' => t('Example block #1'),
      );
      $blocks[1] = array(
        'info' => t('Example block #2'),
      );
      return $blocks;
      break;
    
    case 'configure':
      if ($delta == 0) {
        $form['block_example'] = array(
          '#type' => 'textfield',
          '#title' => t('Block Example Field'),
          '#default_value' => variable_get('example_block_example_field', ''),
        );
      }
      break;
    
    case 'save':
      if ($delta == 0) {
        variable_set('example_block_example_field', $edit['block_example_string']);
      }
      break;
    
    case 'view':
      switch ($delta) {
        case 0:
          $block['subject'] = t('Example Block #1');
          $block['content'] = variable_get('example_block_example_field', '');
          break;
        case 1:
          $block['subject'] = t('Example Block #1');
          $block['content'] = t('Example Block #2');
          break;
      }
      return $block;
      break;
  }
}
duellj’s picture

StatusFileSize
new1.44 KB

Disregard above patch, forgot to remove unrelated code.

solotandem’s picture

Assigned: Unassigned » solotandem
Status: Needs review » Fixed

Patch committed with modifications. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -Intermediate

Automatically closed -- issue fixed for 2 weeks with no activity.