Follow-up of #2224761: Add a generic way to add third party configuration on configuration entities and implement for field configuration.
Problem/Motivation
Since FieldInstanceConfig extends FieldConfigBase, and FieldConfigBase uses ThirdPartySettingsTrait, instances of FieldInstanceConfig can be expected to provide the ThirdPartySettings-related methods. (I'm still a bit inexperienced with this OOP stuff, so bear with me please...) If I understand correctly, it would make sense if FieldInstanceConfigInterface extends ThirdPartySettingsInterface, so other implementations of FieldInstanceConfigInterface must support third party settings too.
As a bonus, implementing ThirdPartySettingsInterface would allow variable type hinting on the FieldInstanceConfigInterface like this (thus enabling code completion in IDE's like PhpStorm):
use Drupal\field\Entity\FieldInstanceConfig;
/** @var \Drupal\field\FieldInstanceConfigInterface $config */
$config = FieldInstanceConfig::load('some.config.id');
$config->getThirdPartySetting('module', 'key', array()); // Typing "getT" in PhpStorm makes the IDE suggest this method.
Proposed resolution
Let FieldInstanceConfigInterface extend ThirdPartySettingsInterface.
Comment | File | Size | Author |
---|---|---|---|
#1 | FieldInstanceConfigInterface_extend_ThirdPartySettingsInterface-2334195-1.patch | 846 bytes | marcvangend |
Comments
Comment #1
marcvangend...and the patch.
Comment #2
XanoComment #3
alexpottI think this interface should extend \Drupal\Core\Field\FieldConfigInterface - I also think we should postpone this on #2312093: Rename FieldInstanceConfig to FieldConfig since this will conflict we'll have some naming issues in this issue to sort out after.
Comment #4
marcvangendOK, FieldInstanceConfig has been renamed to FieldConfig, but I'm not quite sure what the correct fix is now. Alex, can you help me understand the logic to decide who should be extending who?
Comment #5
swentel CreditAttribution: swentel commentedRelated, #2361775: Third party settings dependencies cause config entity deletion
Comment #6
Berdir#2361775: Third party settings dependencies cause config entity deletion happened.