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.
Protected property $dateFormat
in Drupal\datetime\Plugin\views\filter\Date
is assigned the value of DATETIME_DATETIME_STORAGE_FORMAT
when declared, then the same value is assigned again if certain conditions are met in the constructor and then it's used in read only mode only. This clearly can be optimized. I also did it with patch #7 from https://www.drupal.org/node/2912647 applied which is replaces the datetime.module constants with the same in DateTimeInterface constants.
Comment | File | Size | Author |
---|---|---|---|
#2 | interdiff-2912647-2912749.txt | 3.63 KB | angel.h |
#2 | 2912749-2-code_optimization.patch | 52.06 KB | angel.h |
Comments
Comment #2
angel.hHere is the patch with #7 from https://www.drupal.org/node/2912647 applied before that and the interdiff between the patch for this issue and #7 from 2912647.
Comment #3
angel.hComment #5
mpdonadioThanks for the patch, but I am not really sure if this optimization is worth it.
This is a BC break for anything that may have extended this.
This isn't a valid change. $this->dateFormat needs to vary, depending on what the field config is.
With all of the changes to the interface, this is really hard to evaluate. All of the changes to move the constants to the interface are out of scope for this issue.
Comment #8
mpdonadioCleaning up some issues. I looked at this patch again, and the logic that it tries to optimized out is needed to handle datetime/date+only variants. So, closing this for the time being.