Skip to content

Instantly share code, notes, and snippets.

@tedbow
Created June 22, 2016 18:13
Show Gist options
  • Save tedbow/195181deca2bce8c5e31d6862ff94bdd to your computer and use it in GitHub Desktop.
Save tedbow/195181deca2bce8c5e31d6862ff94bdd to your computer and use it in GitHub Desktop.
suggestions
$new_region = NULL;
if (!isset($regions[$this->region]) && $this->status()) {
if (isset($this->original)) {
$original_region = $this->original->getRegion();
// If \Drupal\block\BlockInterface::BLOCK_REGION_NONE was used to
// disable the block and we have an original region then keep in the
// block in the original region.
if (isset($regions[$original_region]) && $this->region == BlockInterface::BLOCK_REGION_NONE) {
$new_region = $original_region;
}
}
if (!$new_region) {
$new_region = system_default_region($this->theme);
}
$this
->setRegion($new_region)
->disable();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment