-
-
Notifications
You must be signed in to change notification settings - Fork 213
Calendar/events optimization #7614
Comments
We then should generalise the |
The closure thing is what we chose in Isotope as well. |
Changed in a4d2d9d. |
Unfortunately, the change in the getter of the
|
Ok, so the problem here is the PHP function if ($this->arrData[$strKey] instanceof \Closure) @contao/developers We are currently using |
Another option would be the following: if (!is_string($this->arrData[$strKey]) && is_callable($this->arrData[$strKey])) I found this variant in one of the Twig classes. |
We should use call_user_func anyway to support static calls etc.
|
We are talking about closures here. Anonymous functions. |
Well you said
That would automatically be solved by using |
Our problem is not how to call the closure but how to detect whether it is a real closure or just a PHP function name. |
IMO DCA callbacks and For For DCA callbacks everything that |
Everything else should also be executed. Because people registered a callback. If the callback is incorrect, the trying-to-execute will raise a message instead of silently ignore it. I totally agree about the template part of what @ausi wrote. Maybe we should use |
You are right, but maybe a custom error message would be nicer.
That would still execute arrays, which we don’t want. |
I did mean |
I don’t think this is necessary because |
Let's discuss this tomorrow. I don't think your suggestions are correct. I have checked the Symfony code and found no occurrences of
We do not want to execute strings aka PHP functions. Arrays, however, seem fine to me. They'll never map to a PHP function, so they are valid callbacks. |
Arrays can also map to PHP functions just like strings can. E.g. |
You have a point. Then we should probably use |
+1 |
Changed in 855fe68. |
I would like to propose a solution that will optimize the calendar/events module. This is also related to other modules like news and faq.
The problem: if you have dozens of events with multiple content elements each, the event list/menu module will generate the content event if it's not displayed. This will consume the resources and a lot of time, especially when you have both of the modules on the same page - the job will be done twice. I have measured the generation time with 50+ events and it took 10-20 seconds per each module (event list, event menu) to generate itself. In total it lasted about half a minute before the page was generated.
The solution: I think that the content elements can be generated on demand, i.e. in the template file. It should be as simple as adding the closure to the template. This way you can call it on demand, only when it needs to be used - like in the events reader module.
The text was updated successfully, but these errors were encountered: