I have a custom block created using Drupal 9 Custom block library. I want to use hook_block_access() to control access to it, but, as it is a custom block, it does not have a block machine name. The only ID I can find (using Devel variables) is:
stdClass Object
(
[CLASS] => Drupal\block_content\Entity\BlockContent
[theme:protected] =>
[values:protected] => Array
(
[id] => Array
(
[x-default] => 4
)
[revision_id] => Array
(
[x-default] => 4
)
[type] => Array
(
[x-default] => basic
)
[uuid] => Array
(
[x-default] => f0c17429-584a-4221-995c-c00f4c41c714
)
[langcode] => Array
(
[x-default] => en
)
[revision_user] => Array
(
[x-default] =>
)
[revision_created] => Array
(
[x-default] => 1632243859
)
[revision_log] => Array
(
[x-default] =>
)
[revision_default] => Array
(
[x-default] => 1
)
[isDefaultRevision] => Array
(
[x-default] => 1
)
[status] => Array
(
[x-default] => 1
)
[info] => Array
(
[x-default] => Add Content
)
[changed] => Array
(
[x-default] => 1632261438
)
[default_langcode] => Array
(
[x-default] => 1
)
[revision_translation_affected] => Array
(
[x-default] => 1
)
[reusable] => Array
(
[x-default] => 1
)
[body] => Array
(
[x-default] => Array
(
[0] => Array
(
[value] =>
etc...
I get to the block edit by going to: http://mysite.com/block/4
How can I use hook_block_access(Block $block, $operation, AccountInterface $account) to control access to this block? How do I identify this block in the $block variable?