buildPreRenderableBlock example

'max-age' => $plugin->getCacheMaxAge(),
        ],
        '#weight' => $entity->getWeight(),
      ];

      // Allow altering of cacheability metadata or setting #create_placeholder.       $this->moduleHandler->alter(['block_build', "block_build_" . $plugin->getBaseId()]$build[$entity_id]$plugin);

      if ($plugin instanceof MainContentBlockPluginInterface || $plugin instanceof TitleBlockPluginInterface) {
        // Immediately build a #pre_render-able block, since this block cannot         // be built lazily.         $build[$entity_id] += static::buildPreRenderableBlock($entity$this->moduleHandler());
      }
      else {
        // Assign a #lazy_builder callback, which will generate a #pre_render-         // able block lazily (when necessary).         $build[$entity_id] += [
          '#lazy_builder' => [static::class D '::lazyBuilder', [$entity_id$view_mode$langcode]],
        ];
      }
    }

    return $build;
  }
Home | Imprint | This part of the site doesn't use cookies.