Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $webform = Drupal::entityTypeManager()->getStorage('webform')->load($machineName);
- $viewBuilder = Drupal::service('entity_type.manager')->getViewBuilder('webform');
- $formBuild = $viewBuilder->view($webform);
- return render($formBuild);
- $build = [
- '#type' => 'webform',
- '#webform' => $machineName,
- ];
- $result = new FilterProcessResult($text);
- ...
- // We need to render the embedded entity:
- // - without replacing placeholders, so that the placeholders are
- // only replaced at the last possible moment. Hence we cannot use
- // either renderPlain() or renderRoot(), so we must use render().
- // - without bubbling beyond this filter, because filters must
- // ensure that the bubbleable metadata for the changes they make
- // when filtering text makes it onto the FilterProcessResult
- // object that they return ($result). To prevent that bubbling, we
- // must wrap the call to render() in a render context.
- $entity_output = $this->renderer->executeInRenderContext(new RenderContext(), function () use (&$build) {
- return $this->renderer->render($build);
- });
- $result = $result->merge(BubbleableMetadata::createFromRenderArray($build));
Add Comment
Please, Sign In to add comment