Posted by vacho on May 12, 2014 at 9:27pm
Hi,
I need help with programing.
I try move block from one region to another with code at Drupal 8.
In specific I try move the "login" block, since sidebar_first region to content region.
Wear hours trying things and can not. Any tips?

Comments
i solve this
I solve this with this code.
function mymodule_block_access(Block $block, $operation, AccountInterface $account, $langcode) {
$is0 = false;
if(drupal_is_front_page() AND !\Drupal::currentUser()->isAuthenticated()) {
$is0 = true;
}
if($is0){
if($block->id == "bartik_login") {
$block->set('region', 'content');
}
if($block->id == "bartik_powered") {
$block->disable();
}
$block->save();
}
return;
}