Hi! :-)
First of all - thanks to all maintainers of this great and usefull module!
Your module was great help to our site from 2013.! :-)

I'm just now work on migrating our site from D7 to D8, and now have some trouble with "Download Count" version 8.x-1.0-alpha1.

I'm not sure that I'm doing all right (in D7 was diferent use), but here what I was do and what error I have.
(Btw. I'm use Drupal 8.7.10.)

I, enable module but with old type settings on D7 (just enable module and he show download count on page) now nothing to see on page with file (pdf) for downloading.
Next when I go to Manage display for content type where I use this file (=Page with pdf atachment) - I saw option "Generic file with download count" for format (for field type). Because with previous "Generic file" I can't see counting on file, I now change this format to "Generic file with download count".
But after this (also: Flush all cache + run cron before futer testing!) - every time when I go to this content type (=Page with pdf atachment) I get this error:
"The website encountered an unexpected error. Please try again later.
Error: Class 'Drupal\download_count\Plugin\Field\FieldFormatter\Html' not found in Drupal\download_count\Plugin\Field\FieldFormatter\FieldDownloadCount->viewElements() (line 60 of modules/contrib/download_count/src/Plugin/Field/FieldFormatter/FieldDownloadCount.php)."

When I revert format to "Generic file" - all is fine, but no counting on file!? :-/

---
PS
Also I see this notice/warning when use this modul:
1) Every time I go to "/admin/reports/download-count" - see notice:
Notice: Undefined index: #element in template_preprocess_pager() (line 178 of core/includes/pager.inc).
Notice: Undefined index: #parameters in template_preprocess_pager() (line 179 of core/includes/pager.inc).
Notice: Undefined index: #quantity in template_preprocess_pager() (line 180 of core/includes/pager.inc).
Notice: Undefined index: #route_name in template_preprocess_pager() (line 181 of core/includes/pager.inc).

2) Every time I go to "/admin/config/media/download-count" - see warning:
Warning: htmlspecialchars() expects parameter 1 to be string, object given in Drupal\Component\Utility\Html::escape() (line 424 of core/lib/Drupal/Component/Utility/Html.php).

PS 2
In moment I was think maybe is problem in correlation with migrate process, so I reinstall modul, but problems are there still.

PS 3
Sorry for my bad english! :-/

Best regards to all maintainers and thanks for great job with this module!! :-)

Comments

Smesko created an issue. See original summary.

s_leu’s picture

Status: Active » Needs review
StatusFileSize
new0 bytes

Here's a patch that will fix the fatal error, but not the mentioned notices.

s_leu’s picture

StatusFileSize
new493 bytes

Wrong patch file, here's the correct one:

Smesko’s picture

Dear friend,
Thanks for your help! :-)
I was test your patch number 2 on my 2 site: Drupal Core 8.7.10 and Drupal Core 8.8.0,
and the main problem from this issue is gone!!! :-)

Now I can go to my book page with atacment (dispay format: "Generic file with download count") - and I now can see page (without error!), and also I can download/view atachment without errors! :-)

Thank you very much for this!

Smesko’s picture

But, I now can see and report (this or in new issue?) that "Download count" don't work. :-/
After downloading of atachment/file - no change of number of downlads - on page with atachment, and also on summary page ( /admin/reports/download-count ).
?
I try also with runing cron, flush all caches, verify of permissions, but no change:
„Never downloaded“. :-/

  • UsingSession committed f92b9d6 on 8.x-1.x authored by s_leu
    Issue #3100498 by s_leu: Error: Class '\''Drupal\download_count\Plugin\...
usingsession’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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