The function languagefield_field_map_filter() is used as an array filter callback in order to prevent some code duplication. The problem is that this function gets called in multiple loops each time an entity's tokens are loaded.
This can lead to this function being called several hundred thousand times in particular page requests (when these tokens are loaded).
This is an identical issue to the one reported (and fixed) for the addressfield module, see: #2416997. As such, parts of both this issue text and the solution have been copied from that issue.
We also do not use these tokens on the site, so I have not tested if the attached patch negatively impacts any token functionality, or if it has been correctly ported from the related solution. I can confirm that with this patch, our affected page load times were reduced by 25%, and the 240 000 function calls no longer appeared in the PHP code profiler.
Fixed
1.7
Code
It affects performance. It is often combined with the Needs profiling tag.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.