Hi,
I have enabled disqus in a fresh new Drupal 8 installation. After creating the Comment Field for Articles, I see this error on node page:
Notice: Undefined offset: 0 in Drupal\disqus\Plugin\Field\FieldFormatter\DisqusFormatter->viewElements() (line 80 of modules/disqus/src/Plugin/Field/FieldFormatter/DisqusFormatter.php).
--------
Drupal\disqus\Plugin\Field\FieldFormatter\DisqusFormatter->viewElements(Object, 'pt-br') (Line: 80)
Drupal\Core\Field\FormatterBase->view(Object, NULL) (Line: 259)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 320)
Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 263)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 220)
Drupal\Core\Entity\EntityViewBuilder->build(Array)
call_user_func(Array, Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 149)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment | File | Size | Author |
---|---|---|---|
#4 | 2879954-04.patch | 1.49 KB | harishpatel86 |
#3 | 2879954-03.patch | 774 bytes | harishpatel86 |
Captura de tela 2017-05-19 às 16.01.02.png | 199.11 KB | elielcezar |
Comments
Comment #2
vegantriathleteI ran into this if I set the number of allowed values to 1. Updating the number of allowed values to unlimited on an existing field did not fix the problem.
I uninstalled the module and then reinstalled it. Then when I added the Disqus comment field and set the number of allowed values to unlimited it worked fine.
I don't know if simply deleting the field and adding it again would fix the problem. I also don't know if using something greater than 1 fixes it or if you must use unlimited.
Comment #3
harishpatel86 CreditAttribution: harishpatel86 commentedHi,
I have faced same issue and find the solution after apply condition. Please see attached patch.
Comment #4
harishpatel86 CreditAttribution: harishpatel86 at Ebizon for Ebizon commentedHi ,
This patch is clone of patch no #3 and there are some correction, i have follow phpcs and phpcbf drupal code standard for fix the warring and notice.
Comment #5
gippy CreditAttribution: gippy as a volunteer commentedComment #6
gippy CreditAttribution: gippy as a volunteer commentedOn a local MAMP system, the problem persisted, using Chrome browser incognito as an anonymous user. I applied 2879954-04.patch using PhpStorm without any problem. I reloaded the page and the problem did not appear. I backed out the patch on PhpStorm and reloaded the page and the problem reappeared. I went back and forth several times and confirmed that when the patch is applied the issue does not appear.
Comment #8
slashrsm CreditAttribution: slashrsm at Tag1 Consulting commentedCommitted. Thanks!