Problem/Motivation

This is a follow up to #2560955: Add ctools agrument plugin to load entity by remote id
I just figured out that the context can be / is created multiple times during the same request - page manager / panels seems to make independent calls.
This can be costly especially if you've enabled to force a remote reload and is mostly unnecessary anyway.

Proposed resolution

Add static caching of the context by default but allow to disable it.
Static caching is implemented by drupal_static() - so there's still the possibility to tamper with the cache directly.

Remaining tasks

Reviews needed.

User interface changes

A new checkbox in the arugment handler config.

API changes

None.

Data model changes

None.

Comments

das-peter created an issue. See original summary.

joachim’s picture

Patch looks good. Thanks!

Though does this really need an option to be disabled? What sort of situation would require that?

das-peter’s picture

Honestly I'm not sure :) I just thought of state-changes or maybe some sort of ctools collision I haven't thought yet. I tend to be defensive with that.
So if you think there isn't a need for the option I'll remove it.