I am on Drupal version 10.1.6 and am using the Quick Node Clone module (v1.16). I can clone any nodes/pages and that all works fine. Most of my pages, if not all, are using layout builder where I can add my custom block types to each page. I have multiple custom block types that are Entity Reference with reference type of Media and a Media type of Image. For example, I have this hero banner block type that has a media field to add a background image to the block.

Now let's say I clone a page with a hero banner block and then want to change the image in the new cloned pag. When I open the layout builder, select to configure the block and remove the existing image and open the media library and select the new image, when I click the insert button, I get the following error:

An AJAX HTTP error occurred. HTTP Result Code: 403 Debugging information follows. Path: /media-library?destination=/node/365/layout&_wrapper_format=drupal_ajax&ajax_form=1&media_library_opener_id=media_library.opener.field_widget&media_library_allowed_types%5Bimage%5D=image&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfield_widget_id%5D=field_background_image_desktop%3A-settings-block_form&media_library_opener_parameters%5Bentity_type_id%5D=block_content&media_library_opener_parameters%5Bbundle%5D=full_width_image_cta&media_library_opener_parameters%5Bfield_name%5D=field_background_image_desktop&media_library_opener_parameters%5Bentity_id%5D=317&media_library_opener_parameters%5Brevision_id%5D=679&hash=DFIR0-jxQRzOJNa-rFxonuXharUm4T4YWuXkREH-rs0&views_display_id=widget StatusText: error ResponseText: {"message":"Non-reusable blocks must set an access dependency for access control."}

I have searched for a solution but still can't figure out how to resolve it. I tried adding a hook_entity_access() in my THEME.theme file but that didn't work.

 * Implements hook_entity_type_access().
function theme_entity_access($operation, $entity_type_id, $entity, $account) {

  if ($entity_type_id === 'block_content' && $operation === 'update') {

    // Allow access to cloned blocks even if permissions missing. 
    return AccessResult::allowed()->cachePerPermissions(); 


Does anyone know how this can be resolved? Thanks in advance.


Your Answer

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

Browse other questions tagged or ask your own question.