You are here

protected function context_reaction_block::editable_region in Context 7.3

Add markup for making a region editable.

1 call to context_reaction_block::editable_region()
context_reaction_block::block_get_blocks_by_region in plugins/context_reaction_block.inc
Get a renderable array of a region containing all enabled blocks.

File

plugins/context_reaction_block.inc, line 322

Class

context_reaction_block
Expose blocks as context reactions.

Code

protected function editable_region($region, $build) {
  if ($this
    ->is_editable_region($region) && (!empty($build) || variable_get('context_reaction_block_all_regions', FALSE) || context_isset('context_ui', 'context_ui_editor_present'))) {
    global $theme;
    $regions = $this
      ->system_region_list($theme);
    $name = isset($regions[$region]) ? $regions[$region] : $region;

    // The negative weight + sorted will push our region marker to the top of the region
    $build['context'] = array(
      '#prefix' => "<div class='context-block-region' id='context-block-region-{$region}'>",
      '#markup' => "<span class='region-name'>{$name}</span>" . "<a class='context-ui-add-link'>" . t('Add a block here.') . '</a>',
      '#suffix' => '</div>',
      '#weight' => -100,
    );
    $build['#sorted'] = FALSE;
  }
  return $build;
}