Use $this->pluginDefinition['provider'] for getConfig and getApiDefinition
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3535963. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !758 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Currently the getConfig looks like this:</p> <pre>&nbsp; /**<br>&nbsp;&nbsp; * {@inheritdoc}<br>&nbsp;&nbsp; */<br>&nbsp; public function getConfig(): ImmutableConfig {<br>&nbsp;&nbsp;&nbsp; $module_name = str_replace('_provider', '', $this-&gt;getPluginId());<br>&nbsp;&nbsp;&nbsp; return $this-&gt;configFactory-&gt;get($module_name . '.settings');<br>&nbsp; }</pre><p>This is problematic, because the plugin id can have any name, not connected to the settings.</p> <p>Instead we should use $this-&gt;pluginDefinition['provider'] that gets the module name.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Change the function getConfig so its using $this-&gt;pluginDefinition['provider'].<br> Also change the function getApiDefinition to using it.</p>
issue