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> /**<br> * {@inheritdoc}<br> */<br> public function getConfig(): ImmutableConfig {<br> $module_name = str_replace('_provider', '', $this->getPluginId());<br> return $this->configFactory->get($module_name . '.settings');<br> }</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->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->pluginDefinition['provider'].<br>
Also change the function getApiDefinition to using it.</p>
issue