- 🇺🇸United States smustgrave
Closing as outdated as additional info was requested 3 months ago.
If still an issue please reopen with an updated issue summary
Thanks!
I have a use case where I need certain users to be able to order a small selection of blocks. In order to load these blocks, I'm using the BlockListBuilder. The trouble is that I want to load blocks which are in a theme other than the theme in use on the current page. Because of this, I have to do the following:
$entity_manager = \Drupal::getContainer()->get('entity.manager');
$list_builder = $entity_manager->getListBuilder('block');
$list_builder->render('name_of_theme', \Drupal::request());
foreach ($list_builder->load() as $block) {
...
}
I'm needing to call the render() function of the list_builder, because that is the only publicly-available way to set the theme which the BlockListBuilder uses. If I don't do that step (despite not needing the resulting rendered form), then the load() function simply returns the blocks of the current theme, which is not what I need.
I know this is a somewhat strange use case (and if there's a better way to "list all blocks of a theme" please let me know... this class just seems to have all the functions which are needed for it, just kind of mixed up with the form-related stuff as well). However, it seems like adding a public setTheme('name_of_theme') function to the BlockListBuilder would be both simple and useful. Then we won't be rendering a whole form which isn't even needed in this scenario.
Closed: outdated
10.1 ✨
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Closing as outdated as additional info was requested 3 months ago.
If still an issue please reopen with an updated issue summary
Thanks!