Commit 6a4ba9df authored by catch's avatar catch

Issue #2124599 by olli, tedbow, swentel: ode_block_access affects access to...

Issue #2124599 by olli, tedbow, swentel: ode_block_access affects access to editing blocks Removes 'operations' links for Block layout page.
parent fee6ae0e
......@@ -153,6 +153,11 @@ public function testRecentNodeBlock() {
$this->assertText($label, 'Block was displayed on the node/N when node is of type article.');
$this->drupalGet('node/' . $node5->id());
$this->assertNoText($label, 'Block was not displayed on nodes of type page.');
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/structure/block');
$this->assertText($label, 'Block was displayed on the admin/structure/block page.');
$this->assertLinkByHref(url('admin/structure/block/manage/' . $block->id()));
}
}
......@@ -8,7 +8,6 @@
* API pattern.
*/
use Drupal\Component\Utility\String;
use Drupal\Core\Language\Language;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Cache\Cache;
......@@ -23,6 +22,8 @@
use Drupal\file\Entity\File;
use Drupal\language\Entity\Language as LanguageEntity;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Drupal\block\Entity\Block;
use Drupal\Core\Session\AccountInterface;
/**
* Denotes that the node is not published.
......@@ -1075,7 +1076,11 @@ function node_form_block_form_alter(&$form, &$form_state) {
* Checks the content type specific visibility settings and removes the block
* if the visibility conditions are not met.
*/
function node_block_access($block) {
function node_block_access(Block $block, $operation, AccountInterface $account, $langcode) {
// Only affect access when viewing the block.
if ($operation != 'view') {
return;
}
$visibility = $block->get('visibility');
if (!empty($visibility)) {
if (!empty($visibility['node_type']['types'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment