Updated: Comment #N

Problem/Motivation

The config translations module (and contrib modules) needs a way to provide more metadata about config data types. There is no alter hook to enhance existing the existing data types.

Proposed resolution

Add a hook to the TypedConfigManager

Remaining tasks

-

User interface changes

-

API changes

-

#2100221: Refactor form element into a class

Original report by @webflo

-

Files: 
CommentFileSizeAuthor
#4 add-hook_config_typed_info_alter-2100223-4.patch8.08 KBwebflo
PASSED: [[SimpleTest]]: [MySQL] 59,151 pass(es). View
#4 add-hook_config_typed_info_alter-2100223-1-4.interdiff.txt8.07 KBwebflo
#1 add-hook_config_typed_info_alter-2100223-1.patch3.31 KBwebflo
FAILED: [[SimpleTest]]: [MySQL] 58,301 pass(es), 29 fail(s), and 397 exception(s). View

Comments

webflo’s picture

Status: Active » Needs review
FileSize
3.31 KB
FAILED: [[SimpleTest]]: [MySQL] 58,301 pass(es), 29 fail(s), and 397 exception(s). View
vijaycs85’s picture

Good work @webflo. Few minor code review stuffs below. Overall, looks OK to me.

  1. +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php
    @@ -40,6 +41,18 @@ class TypedConfigManager extends PluginManagerBase implements TypedConfigManager
    +  /**
    
    @@ -47,12 +60,26 @@ class TypedConfigManager extends PluginManagerBase implements TypedConfigManager
    +  protected function alterInfo(ModuleHandlerInterface $module_handler, $alter_hook) {
    

    Can we add the comment for this property please?

  2. +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php
    @@ -47,12 +60,26 @@ class TypedConfigManager extends PluginManagerBase implements TypedConfigManager
    +    $this->alterInfo($module_handler, 'config_typed_info');
    

    isn't it hook_config_typed_data_info_alter() ? Also wondering, would this protected method add any value? can't we do the assignment in construction itself?

Status: Needs review » Needs work

The last submitted patch, add-hook_config_typed_info_alter-2100223-1.patch, failed testing.

webflo’s picture

Issue tags: +D8MI, +language-config, +blocker
FileSize
8.07 KB
8.08 KB
PASSED: [[SimpleTest]]: [MySQL] 59,151 pass(es). View

Fixed tests and added the changes from comment #2

I renamed the hook to hook_config_type_info similar to hook_data_type_info_alter.

webflo’s picture

Status: Needs work » Needs review

Go testbot!

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks good.

Status: Reviewed & tested by the community » Needs work
Issue tags: -D8MI, -language-config, -blocker

The last submitted patch, add-hook_config_typed_info_alter-2100223-4.patch, failed testing.

vijaycs85’s picture

Status: Needs work » Needs review
Issue tags: +D8MI, +language-config, +blocker
Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +sprint

Back to RTBC since core was failing with a random fail.

webflo’s picture

Issue summary: View changes

Update

webflo’s picture

Issue summary: View changes

Fixed typo

webflo’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

We resolve this issue in config_translation itself and extend the existing TypedConfigManager to enhance the config type definition.

alexpott’s picture

After discussing this @webflo in Prague I don't think that we should be providing a method to alter config typed data metadata as I don't think we should allow modules to be altering such fundamental metadata just to enhance it. Apparently the config translation ui is already extending the locale type data manager so we could decorate the data here instead. That way we won't have yet another alter that can completely pollute / change the meaning of stuff from under our feet.

Gábor Hojtsy’s picture

Issue tags: -sprint

Sure.

tstoeckler’s picture

Status: Closed (won't fix) » Needs review

I would like to get some more reasoning for this. Specifically, I don't understand how this is not viable, if hook_data_type_info_alter() is. Thanks!

Gábor Hojtsy’s picture

Seems to me like the last two sentences from @alexpott were reason enough? :)

tstoeckler’s picture

Well, that could still use some clarification for noobs like me :-)
I was in the middle of posting a more detailed answer, but I ended quoting the entire last two sentences in #11. So in short: I don't understand at all, what is meant.

Thanks, guys!

tstoeckler’s picture

Issue summary: View changes

Added _no_

mariancalinro’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

I'll close this as won't fix, this seems to be the consensus.