Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As described in #2698337 I used the template generator to create the calendar views. The week view is currently broken for me. If opened I get a blank page. The error log reads:
mod_fcgid: stderr: PHP Fatal error: Class 'Drupal\\datetime\\Plugin\\views\\Argument\\Date' not found in /.../modules/calendar/src/Plugin/views/argument/DatetimeYearWeekDate.php on line 18
Comment | File | Size | Author |
---|---|---|---|
#6 | calendar-Week-view-produces-PHP-fatal-error-2698353-5-8.x.patch | 620 bytes | afeijo |
Comments
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedThis class has been around a long time: #1838242: Provide Views integration for datetime field
I do however see that we don't have an explicit dependency to the DateTime module. Is it enabled? Did you do a full install?
Comment #3
pheraph CreditAttribution: pheraph commentedI installed via
drush en calendar
. Both modules (calendar, calendar_datetime) and the core module datetime are enabled. Strange.Comment #4
la_gnf_1 CreditAttribution: la_gnf_1 commentedI am getting this same error with the week view. Did you figure out what the problem/fix is? Thanks.
Comment #5
afeijoI'm facing the same problem, and after analysing the calendar code, I figured out the problem
It is a simple case sensitive issue
change the line 11
use Drupal\datetime\Plugin\views\Argument\Date as DateTimeDate;
to
use Drupal\datetime\Plugin\views\argument\Date as DateTimeDate;
Comment #6
afeijoproviding the patch
Comment #7
la_gnf_1 CreditAttribution: la_gnf_1 commentedafeijo, Your patch fixed the issue for me. Thanks.
Comment #8
pheraph CreditAttribution: pheraph commentedYes, #6 fixed it for me, too. Thanks afeijo.
Comment #9
pheraph CreditAttribution: pheraph commentedComment #10
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedPHP namespaces should be case-insensitive, however, from what I found it's possible that autoloading makes the namespaces case-sensitive anyway.
Since several people verified that the patch is needed even though I cannot reproduce it (might be due to OS or PHP version), I committed and pushed it to 8.x-1.x, along with the removal of some redundant newlines in that file. Thanks!
Please note that the Date class to which the use statement refers, has the capital in it's namespace even though all other classes around it don't have it.
namespace Drupal\datetime\Plugin\views\Argument;
If this proves to be an issue, a bug should be filed against core (datetime module).