Problem/Motivation

After adding a custom block you can find the custom block in the list of admin/structure/block, but you are not provided with a link to edit this block.

To actually edit the block you have to switch to the "Custom block library" admin/structure/block/block-content, to find the contextual "Edit" link you are looking for.

This is very puzzeling, especially if you manage to create your new block on admin/structure/block by clicking "Place block" near a region header and follow "Add custom block" in the dialog. This way you are able to create a block without ever visiting the "Custom block library".

Proposed resolution

Add an "Edit" link for custom blocks in admin/structure/block.

Remaining tasks

- Add contextual links
- Write/adapt tests

User interface changes

- Custom block have an extra link in the list of admin/structure/block.

Original issue summary

Referring to http://drupal.stackexchange.com/questions/144133/contextual-links-for-cu...

"I have created a custom block type and it would be wonderful to have a link in the block dropbutton: "Edit block content"."

thanks and regards
sb

Comments

larowlan’s picture

Version: 8.0.0-beta4 » 8.0.x-dev
grendzy’s picture

g.oechsler’s picture

Issue summary: View changes
Status: Closed (duplicate) » Needs work
StatusFileSize
new42.23 KB

This is not a duplicate of #2284917: In-place editing of custom blocks broken *again* (because attributes and contextual links of custom blocks are lost).

This is about the contextual links on admin/structure/block.

I updated the summary to point out the issue.

g.oechsler’s picture

Issue tags: +Usability
g.oechsler’s picture

Status: Needs work » Needs review
StatusFileSize
new2.95 KB

Here's a first shot at this.
Let's see what the testbot thinks of it.

lewisnyman’s picture

Issue tags: +Needs usability review
lewisnyman’s picture

Title: Contextual links for custom blocks: Add “Edit block content” » Add a way to edit block content on the block layout page
Component: contextual.module » block.module
Category: Feature request » Task
Issue summary: View changes
olli’s picture

MattA’s picture

I don't really think hard-coding support for only the block_content.module in block.module is the way to go. Looks like #1956134: Provide helpful editing links on "admin/structure/block" for deriver blocks (menu, views, block content, etc.) had a generic implementation that would have supported menus and views too, but OperationsProviderInterface is no longer used anywhere in core, so that won't work anymore.

Bojhan’s picture

This needs a screenshot.

tim.plunkett’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Needs review » Postponed

@LewisNyman Can you elaborate why you moved this to a task? Still reads like a feature request to me.
Either way, not a bug fix.

lewisnyman’s picture

Category: Task » Feature request

@tim.plunkett hmm good question. I can't remember and it doesn't seem clear to me looking at the issue summary. Let's change it back in that case.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

murz’s picture

Same UI problem with editing block content also have Layout Builder edit page. Custom blocks can be edited only via small right sidebar, that have very little width. Will be good to have also contextual link to full block edit page.

andriyun’s picture

StatusFileSize
new3.09 KB

Rerolled patch #5

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Oscaner’s picture

I add an "Edit" contextual link for content block in layout screen, this can redirect to the block edit screen.

edit_link.png

Oscaner’s picture

StatusFileSize
new174.83 KB
no74h’s picture

StatusFileSize
new838 bytes

Hi, I edited patch in #23 to also support core (edit, translate..) contextual links in layout edit page for block content types and their translations.

Oscaner’s picture

StatusFileSize
new1.53 KB

Change the #23 patch to only block_content block, no inline_block.

no74h’s picture

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

maithili11’s picture

Some changes in the #23 patch to work with 8.9.9.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

anybody’s picture

#1956134: Provide helpful editing links on "admin/structure/block" for deriver blocks (menu, views, block content, etc.) looks like a (better as more general) duplicate to this issue. Keeping this postponed, but after that issue was fixed, we should check to close this as duplicate.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed » Closed (duplicate)

So this functionality is being applied to https://www.drupal.org/project/drupal/issues/1956134. So I'm closing as a duplicate and will leave a comment in https://www.drupal.org/project/drupal/issues/1956134 for credit to be moved over.

If anyone feels this is a separate issue please reopen with explanation of difference.

Thanks.

luis_oliveira’s picture

I used patch #30 but did not work, I did some debugging and found out that in Drupal 10 the array key 0 does not exist so the if statement would be skipped.

<?php
if (isset($build[$region][$uuid]['content'][0]['#block_content'])) {
?>

I fixed that and added the "edit" option in the operation metadata.

luis_oliveira’s picture

Version: 9.5.x-dev » 10.2.x-dev