You are here

protected function context_reaction_block::max_block_weight in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_reaction_block.inc \context_reaction_block::max_block_weight()
  2. 7.3 plugins/context_reaction_block.inc \context_reaction_block::max_block_weight()

Generate the safe weight range for a block being added to a region such that there are enough potential unique weights to support all blocks.

1 call to context_reaction_block::max_block_weight()
context_reaction_block::options_form in plugins/context_reaction_block.inc
Options form.

File

plugins/context_reaction_block.inc, line 388

Class

context_reaction_block
Expose blocks as context reactions.

Code

protected function max_block_weight() {
  $blocks = $this
    ->get_blocks();
  $block_count = 0;
  foreach ($blocks as $region => $block_list) {
    $block_count += count($block_list);
  }

  // Add 2 to make sure there's space at either end of the block list
  return round(($block_count + 2) / 2);
}