0

I have the Nodeblock and the Contextual links modules installed. They work fine, but I want to add the "Edit node" link in the contextual links for node blocks. For views, there is a "Edit view" link, but not for nodes. Is there a way to do that, maybe with a preprocess block function?

3 Answers 3

0

Ok, it looks like you have to hover the actual body of the block to see those links. It doesn't display them if you hover just the title.

0

You could add contextual link with a little piece of code very easily.

You have to use block_contextual_links_view_alter hook to add a link to a block.

function my_module_block_contextual_links_view_alter(&$element, &$items) {


            $element['#links']['edit_f_block'] = array(
            'title' => 'Change Content',
            'href' => url('admin/config/front/block', array('absolute' => TRUE)),
            );

}

This adds to all blocks, you should probably check which block it is and also if element is a block. See this post for a detailed understanding.

0

Try the Custom Contextual Links module. Here is an excerpt about it from the module's project page:

The Custom Contextual Links module allows you to add your own links to the contextual drop down widgets of blocks and nodes.

Contextual links are really great for quick access to settings pages within your Drupal install. They cut down the time required to click through the sometimes cumbersome Drupal administrative navigation. However, the links displayed in the contextual widget need to be defined through a module. This is where CCL comes in. This module allows you to add and manage custom links through a UI that will be displayed in the contextual widgets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.