Problem/Motivation

There is still lots of information to duplicate in the *.config_translation.yml file that people can avoid or even entirely skip for their config entities. Figure out how we can automate most (or all) of that. This is dependent on #2083615: Use links annotation for config entity URI like for content entities and #2085907: Ensure all configuration entities have an Edit/Configure tab by default, so we get default edit tabs and route/path information from entity info.

Proposed resolution

Generate the entity mapper data by querying entity information and ignore the menu tabbing stuff entirely, since core would already do it.

Remaining tasks

Do it.

User interface changes

None.

API changes

*.config_translation.yml would change. Possible that something would change for config entity definition(?).

#2085907: Ensure all configuration entities have an Edit/Configure tab by default and #2083615: Use links annotation for config entity URI like for content entities.

CommentFileSizeAuthor
#47 2085925-config-trans-dx-47.patch20.36 KBtstoeckler
#47 2085925-config-trans-dx-interdiff-45-47.txt859 byteststoeckler
#45 2085925-config-trans-dx-45.patch19.84 KBtstoeckler
#45 2085925-config-trans-dx-interdiff-43-45.patch5.56 KBtstoeckler
#43 2085925-config-trans-dx-43.patch16.46 KBtstoeckler
#43 2085925-config-trans-dx-interdiff-41-43.txt690 byteststoeckler
#41 2085925-config-trans-dx-41.patch16.39 KBtstoeckler
#41 2085925-config-trans-dx-interdiff-39-41.txt1.8 KBtstoeckler
#39 2085925-config-trans-dx-39.patch16.39 KBtstoeckler
#37 2085925-config-trans-dx-37.patch17.75 KBtstoeckler
#37 2085925-config-trans-dx-interdiff-33-37.txt1.68 KBtstoeckler
#33 2085925-config-trans-dx-32.patch17.04 KBtstoeckler
#33 2085925-config-trans-dx-interdiff-30-33.txt1.77 KBtstoeckler
#30 2085925-config-trans-dx-27.patch17.01 KBtstoeckler
#30 2085925-config-trans-dx-interdiff-26-27.txt6.24 KBtstoeckler
#26 2085925-config-trans-dx-26-do-not-test.patch14.71 KBtstoeckler
#22 2085925-config-trans-dx-22.patch14.67 KBtstoeckler
#21 2085925-config-trans-dx-21.patch0 byteststoeckler
#21 2085925-config-trans-dx-interdiff-19-21.txt518 byteststoeckler
#19 2085925-config-trans-dx-19.patch14.67 KBtstoeckler
#19 2085925-config-trans-dx-16-19.txt4.17 KBtstoeckler
#16 2085925-config-trans-dx-16.patch13.99 KBtstoeckler
#16 2085925-config-trans-dx-interdiff-14-16.txt6.03 KBtstoeckler
#16 2085925-config-trans-dx-interdiff-no-whitespace-14-16.txt5.49 KBtstoeckler
#14 2085925-config-trans-dx-10.patch12.24 KBtstoeckler
#14 2085925-config-trans-dx-interdiff-9-10.txt9.62 KBtstoeckler
#9 2085925-config-trans-dx-9.patch4.95 KBtstoeckler
#7 config-translation-dx-7.patch14.51 KBGábor Hojtsy
#5 config-translation-dx-5.patch4.49 KBGábor Hojtsy
#3 config-translation-dx.patch4.49 KBGábor Hojtsy
#1 remove-edit-tab-stuff.patch624 bytesGábor Hojtsy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
624 bytes

This would be a starter patch.

YesCT’s picture

Glad to see a start here. I was thinking of trying to get something here to show that #2085907: Ensure all configuration entities have an Edit/Configure tab by default would work now that #1834002: Configuration delete operations are all over the place is in.

Gábor Hojtsy’s picture

FileSize
4.49 KB

All the dependencies are in, delete tabs, edit tabs and URI patterns, so this may be a step forward. @YeCT can you help figure out how to make this work with the entity manager service instead of global functions? :)

I think we may be able to generate the whole list of entities in a function ourselves and entirely ignore needing to define them in the config_translation.yml :) That would be ideal. Eg. go through all config entity types that have the links { 'edit-link' = ... } annotation and automatically register those with the config translation UI. Our alter hooks would still let people to opt out of it later on. That would mean if you have a config entity implemented with the best practices and you have config schema, you **automatically** would get a config translation UI for your stuff, which is IMHO pretty nice :)

Status: Needs review » Needs work

The last submitted patch, config-translation-dx.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
4.49 KB

The link key name is edit-form not edit-link :D

Status: Needs review » Needs work

The last submitted patch, config-translation-dx-5.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
14.51 KB

More complete patch that includes #2093007: drupalPost => drupalPostForm() in tests and other core fails for now. That should be committed first to ensure a passing 8.x-1.x branch.

Status: Needs review » Needs work

The last submitted patch, config-translation-dx-7.patch, failed testing.

tstoeckler’s picture

Here's a straight re-roll for startes as the drupalPostForm() patch was committed. This will not pass, but then I can provide an interdiff on top of this.

Gábor Hojtsy’s picture

#2093007: drupalPost => drupalPostForm() in tests and other core fails landed now, so most of this can be removed. Since the last patch includes that too :D

Gábor Hojtsy’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: -D8MI, -sprint, -language-config

The last submitted patch, 2085925-config-trans-dx-9.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
Issue tags: +D8MI, +sprint, +language-config

#9: 2085925-config-trans-dx-9.patch queued for re-testing.

tstoeckler’s picture

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-10.patch, failed testing.

tstoeckler’s picture

Here we go. The previous patch failed because I passed the entity manager into the constructor at the wrong spot.

Also I added a typehint for $entity_manager in ConfigEntityMapper::__construct() after creating the interdiff(s) and couldn't be bothered to roll new ones. I promise that's the only thing I changed outside of the interdiff(s).

Because I had to change the indentation of a whole chunk of code I also provided an interdiff with the "no-whistespace" option of Git.

This should be close to done, I hope.

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-16.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
  1. +++ b/lib/Drupal/config_translation/ConfigEntityMapper.php
    @@ -16,20 +17,51 @@ use Symfony\Component\HttpFoundation\Request;
    +   * The entity manager
    

    . missing :)

  2. +++ b/lib/Drupal/config_translation/ConfigEntityMapper.php
    @@ -16,20 +17,51 @@ use Symfony\Component\HttpFoundation\Request;
    +   * Constructs a ConfigEntityMapper
    

    . missing :)

  3. +++ b/lib/Drupal/config_translation/ConfigMapperManager.php
    @@ -50,28 +65,45 @@ class ConfigMapperManager extends DefaultPluginManager {
    +        // @todo Explain why we don't t() this and why we do this weirdness in
    +        //   the first place.
    +        '@label ' . Unicode::strtolower($entity_type),
    

    We can actually do t('@label @entity') :) Maybe not very useful, but I can imagine languages where the order need to be swapped.

  4. +++ b/lib/Drupal/config_translation/ConfigMapperManager.php
    @@ -50,28 +65,45 @@ class ConfigMapperManager extends DefaultPluginManager {
    +        FALSE
    

    Already defaults to FALSE, so I would avoid this magic value :) If the local task is also default, etc. remove those as well IMHO.

tstoeckler’s picture

Fixed #18.

Also: Really, Drupal?!? language_manager, but entity.manager? ...

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-19.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
518 bytes
0 bytes

Pretty please, little bot?!

tstoeckler’s picture

/me no like empty patch

(interdiff should be correct, though)

Status: Needs review » Needs work
Issue tags: -D8MI, -sprint, -language-config

The last submitted patch, 2085925-config-trans-dx-22.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review

#22: 2085925-config-trans-dx-22.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +D8MI, +sprint, +language-config

The last submitted patch, 2085925-config-trans-dx-22.patch, failed testing.

tstoeckler’s picture

Straight re-roll. Not testing yet, as it will fail in the same way as before.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
dawehner’s picture

  1. +++ b/config_translation.services.yml
    @@ -10,4 +10,9 @@ services:
    +    arguments:
    +      - '@cache.cache'
    +      - '@language_manager'
    +      - '@module_handler'
    +      - '@entity.manager'
    +      - '@string_translation'
    

    OOOOH, this is nice!

  2. +++ b/lib/Drupal/config_translation/ConfigMapperManager.php
    @@ -50,31 +73,50 @@ class ConfigMapperManager extends DefaultPluginManager {
    +        $this->t('@label @entity_type', array('@entity_type' => Unicode::strtolower($entity_type))),
    

    Oh @label is not replaced on here?

Gábor Hojtsy’s picture

@label is replaced later on.

tstoeckler’s picture

Here we go. *crossingfingers*

tstoeckler’s picture

Self-review of the interdiff:

  1. +++ b/lib/Drupal/config_translation/ConfigEntityMapper.php
    @@ -55,10 +57,12 @@ class ConfigEntityMapper extends ConfigNamesMapper {
    -  public function __construct($base_path_pattern, $title, EntityManager $entity_manager, $names = array(), $menu_item_type = MENU_LOCAL_TASK, $add_edit_tab = FALSE) {
    +  public function __construct($base_path_pattern, $title, $id, EntityManager $entity_manager, $names = array(), $menu_item_type = MENU_LOCAL_TASK, $add_edit_tab = FALSE) {
    

    This should actually been part of the re-roll above, but I missed it there.

  2. +++ b/lib/Drupal/config_translation/ConfigMapperManager.php
    @@ -77,12 +77,14 @@ class ConfigMapperManager extends DefaultPluginManager {
    +        !in_array('\Drupal\Core\Config\Entity\ConfigEntityInterface', class_implements($entity_info['class'])) ||
    

    Yeah, this part is pretty important... *slapsforehead*

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-27.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
1.77 KB
17.04 KB

OMFG, the constructor change took an infinite amount to figure out. I need more sleep...

Status: Needs review » Needs work
Issue tags: -D8MI, -sprint, -language-config

The last submitted patch, 2085925-config-trans-dx-32.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review

#33: 2085925-config-trans-dx-32.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +D8MI, +sprint, +language-config

The last submitted patch, 2085925-config-trans-dx-32.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
1.68 KB
17.75 KB

Here we go. This fixes one issue and also introduces some debug code for the bot in case this still fails.

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-37.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
Issue tags: +prague2013
FileSize
16.39 KB

I rerolled this for the latest commits.

Status: Needs review » Needs work
Issue tags: -prague2013

The last submitted patch, 2085925-config-trans-dx-39.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
1.8 KB
16.39 KB

If this passes, I owe @vijaycs85 a very large amount of tea/beer/...

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-41.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
690 bytes
16.46 KB

Thanks @GáborHojtsy for helping with the actual fail.

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-43.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
5.56 KB
19.84 KB

Here we go. SimpleTest decided to work again on my laptop, so I hope I won't have to spam this issue as much. At least one test case passes with this, let's see...

Status: Needs review » Needs work

The last submitted patch, 2085925-config-trans-dx-interdiff-43-45.patch, failed testing.

tstoeckler’s picture

Status: Needs work » Needs review
FileSize
859 bytes
20.36 KB

So this passes completely on my system.

Gábor Hojtsy’s picture

Status: Needs review » Fixed

Yay, committed this one except the debug stuff :D http://drupalcode.org/project/config_translation.git/commit/ffd5a2ef0e67...

tstoeckler’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Issue tags: +Prague Hard Problems

Retroactive tagging.

Gábor Hojtsy’s picture

Issue tags: -sprint