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)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

elielcezar created an issue. See original summary.

vegantriathlete’s picture

I 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.

harishpatel86’s picture

FileSize
774 bytes

Hi,

I have faced same issue and find the solution after apply condition. Please see attached patch.

harishpatel86’s picture

FileSize
1.49 KB

Hi ,

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.

gippy’s picture

Status: Active » Needs review
gippy’s picture

Status: Needs review » Reviewed & tested by the community

On 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.

  • slashrsm committed 3f8e663 on 8.x-1.x authored by harish Patel
    Issue #2879954 by harish Patel, elielcezar, gippy, vegantriathlete:...
slashrsm’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.