Poll as a field in Views of content types

Created on 18 March 2024, 3 months ago

I added poll as a field in a content type-let be 'Article'.Then output poll as a rendered entity wherever required.

Now I have created a view listing the content type with customization.Added a field for poll and displayed as rendered entity to show whole poll form.
Now my issue when i call the above poll field in Custom text in view,the poll is not rendered.If displaying directly there is noissue.Is there any way to fix this.
Tried to call in custom way.didnt work

In custom code tried below

$form = \Drupal::entityTypeManager()
->getFormObject('poll', 'default')
->setEntity($poll);

return \Drupal::formBuilder()->getForm($form);

Got below error

TypeError: Drupal\Core\Entity\EntityRepository::getTranslationFromContext(): Argument #1 ($entity) must be of type Drupal\Core\Entity\EntityInterface, null given, called in /modules/contrib/poll/src/Entity/Poll.php on line 401 in Drupal\Core\Entity\EntityRepository->getTranslationFromContext() (line 93 of /core/lib/Drupal/Core/Entity/EntityRepository.php)

📌 Task
Status

Active

Version

1.6

Component

Code

Created by

🇮🇳India fatima2345

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024