I am unable to access the delta property from layout builder's block forms. I've had a look into the code and searched for issues and found the parent issue / related issue i've attached, but from those, I can't see a getDelta function to access the protected delta property in the Drupal\layout_builder\Form\ConfigureBlockFormBase class.

I'm not sure if i'm missing something that is in the component or section, but when trying to debug them, neither have the delta property. Either adding a getDelta function to the ConfigureBlockFormBase class or elsewhere would obviously sort this.

Hope someone can help with this

Comments

BryanLund created an issue. See original summary.

tim.plunkett’s picture

Category: Bug report » Feature request

What is the use case for needing the delta?

BryanLund’s picture

I'm trying to add a custom block generated through code to a section in the layout builder and from my understanding the delta is which section you're in? So i'm wanting to make sure the block gets saved to the right section. I couldn't see any documentation saying how to add a block generated through code to the layout builder (apologies if there is some somewhere). I managed to add the block fine, but none of the contextual links were loading by default. I had a look into the layout builder code and noticed the contextual links were added as:

return [
  '#contextual_links' => [
    'layout_builder_block' => [
      'route_parameters' => [
        'section_storage_type' => $storage_type,
        'section_storage' => $storage_id,
        'delta' => $delta,
        'region' => $region
        'uuid' => $uuid,
      ],
      'metadata' => [
        'operations' => 'move:update:remove',
      ]
    ]
  ]
];

I've managed to get the rest of the parameters, but couldn't see a way of getting delta. Apologies again if there is some documentation somewhere for this, but I haven't seen any. Also, happy to go down a different route if there's a better way that you could advise, thanks!

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

Drupal 8.7.9 was released on November 6 and is the final full bugfix release for the Drupal 8.7.x series. Drupal 8.7.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.8.0 on December 4, 2019. (Drupal 8.8.0-beta1 is available for testing.)

Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.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: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should 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: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

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

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.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.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.