I want to add a custom contextual link on the top of every block. there are many answers available on the site but these answers are about adding a contextual link to a specific block. and I need to add a contextual link which appears in the contextual menu of every block available in the site. I have tried this function.
function MYMODULE_contextual_links_view_alter(&$element, &$items) {
if (isset($element['#element']['#block'])) {
$element['#links']['animation'] = array(
'title' => 'change animation',
);
}
}
I didn't get what I want.