Add OverridableFunctionCallInterface to support per-instance context definition overrides on function call plugins
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3584421. --> Reported by: [rob_e](https://www.drupal.org/user/3350728) Related to !1487 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>Add support for per-instance context definition overrides on function call plugins via a new OverridableFunctionCallInterface<br> <strong>Check-in Date: </strong>13/04/2026<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p><code>FunctionCallBase</code> resolves context definitions from the plugin manager's cached definition array via <code>ContextAwarePluginTrait</code>. There is currently no supported way for a caller to supply a modified <code>ContextDefinition</code> for a specific property on a specific plugin instance - any modification has to be made directly to the definition returned by <code>getContextDefinition()</code>.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Introduce a new <code>OverridableFunctionCallInterface</code> that extends <code>FunctionCallInterface</code> and declares a single method:</p> <div class="codeblock"> <pre><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br>&nbsp;</span><span style="color: #007700">public function </span><span style="color: #0000BB">setContextDefinitionOverride</span><span style="color: #007700">(</span><span style="color: #0000BB">string $name</span><span style="color: #007700">, </span><span style="color: #0000BB">ContextDefinitionInterface $definition</span><span style="color: #007700">): </span><span style="color: #0000BB">void</span><span style="color: #007700">; <br></span><span style="color: #0000BB">?&gt;</span></span></pre></div> <p>Update <code>FunctionCallBase</code> to implement this interface by storing overrides in a per-instance <code>$contextDefinitionOverrides</code> array and overriding <code>getContextDefinition()</code> and <code>getContextDefinitions()</code> to check that array first before falling back to the shared plugin definition.</p> <p>This allows callers to provide a per-instance <code>ContextDefinition</code> for a property, with both <code>normalize()</code> and <code>validateContexts()</code> picking it up automatically.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>Add new interface and update <code>FunctionCallBase</code></p>
issue