Created
August 5, 2019 13:12
-
-
Save szeidler/2476c269bf34ea2429bfc72aae0c5ca4 to your computer and use it in GitHub Desktop.
Make block_content contextual links available in Layout Builder blocks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_theme_preprocess_block(&$variables) { | |
// Make block_content contextual links available in Layout Builder blocks. | |
if(!empty($variables['content']['#block_content'])){ | |
if (empty($variables['title_suffix']) && isset($variables['elements']['content']['#contextual_links'])) { | |
$variables['title_suffix']['contextual_links'] = [ | |
'#type' => 'contextual_links_placeholder', | |
'#id' => _contextual_links_to_id($variables['elements']['content']['#contextual_links']), | |
]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment