Problem/Motivation

Content types have a "Diff" tab where you can select a view mode for comparision.

The setting is currently used to filter field diff plugins additionally, confusing users.

Proposed resolution

We should simply remove it.

A generalised setting for default visual inline diff view mode can be introduced in follow-up if need is confirmed.

Remaining tasks

Implement

Comments

miro_dietiker created an issue. See original summary.

ModernMantra’s picture

Assigned: Unassigned » ModernMantra
Status: Active » Needs review
StatusFileSize
new751 bytes

Status: Needs review » Needs work

The last submitted patch, 2: generalised-2808993-2.patch, failed testing.

johnchque’s picture

+++ b/src/DiffBuilderManager.php
@@ -137,7 +137,7 @@ class DiffBuilderManager extends DefaultPluginManager {
+      $view_mode = $this->config->get($field_definition->getTargetEntityTypeId() . $target_bundle . '.view_mode');

I think there is a '.' between the targetentitytypeid and the targebundle.

ModernMantra’s picture

Status: Needs work » Needs review
StatusFileSize
new757 bytes
new686 bytes

Added dot as suggested in previous comment.

Status: Needs review » Needs work

The last submitted patch, 5: generalised-2808993-5.patch, failed testing.

miro_dietiker’s picture

+++ b/src/DiffBuilderManager.php
@@ -137,7 +137,7 @@ class DiffBuilderManager extends DefaultPluginManager {
+      $view_mode = $this->config->get($field_definition->getTargetEntityTypeId() . '.' . $target_bundle . '.view_mode');

You're lucky creating this key without a prefix at all. Entity type id could clash with other keys.

And i guess changing this key will need a change in the schema.
And if we get it, somewhere must be code that sets it... Tests must fail without updating a setter also.

ModernMantra’s picture

Status: Needs work » Needs review
StatusFileSize
new2.29 KB
new0 bytes

Had some discussion with @berdir, unfortunately tests fails and i am not sure how to fix it. ALso made some changes regarding comment #7.

Status: Needs review » Needs work

The last submitted patch, 8: generalised-2808993-8.patch, failed testing.

johnchque’s picture

+++ b/src/DiffBuilderManager.php
@@ -137,7 +137,7 @@ class DiffBuilderManager extends DefaultPluginManager {
+     $view_mode = $this->config->get('bundle_settings' . '.' . $field_definition->getTargetEntityTypeId() . '.' . $target_bundle . '.view_mode');

don't use the getTargetEntityTypeId() here, just use the target bundle.

berdir’s picture

#10 is wrong. That is actually the only call that is correct, all the others and the schema is wrong.

ModernMantra’s picture

Status: Needs work » Needs review
StatusFileSize
new2.72 KB
new1.8 KB
johnchque’s picture

Status: Needs review » Needs work
+++ b/src/DiffBuilderManager.php
@@ -137,7 +137,7 @@ class DiffBuilderManager extends DefaultPluginManager {
+     $view_mode = $this->config->get('bundle_settings' . '.' . $field_definition->getTargetEntityTypeId() . '.' . $target_bundle . '.view_mode');

Don't change the indentation here please. :)

We might need an update function for this config change.

berdir’s picture

+++ b/config/schema/diff.schema.yml
@@ -43,16 +43,19 @@ diff.settings:
+        type: sequence
+        label: 'Target bundle'
+        sequence:
+          type: mapping
+          label: 'Content type'

target bundle and content type is the same thing. The first level is the *entity type*.

And yeah, we need to update the existing configuration. Another question is that we now change the structure to theoretically support other entity types. But we actually don't do that yet. Not sure if we should do that her or in another issue. another issue might be better as that won't be trivial (likely needs its own form that lists all relevant entity types and their bundles, similar to share message/like_and_dislike) as we can't reliably alter any bundle form out there.

miro_dietiker’s picture

Hm, this might sound strange, but...
What is this setting used for?
I can't see any effect.

The view mode can be selected when comparing with visual diff plugin.
And with the fields, we have field plugins.

I see that the dropdown on admin/structure/types/manage/TYPE offers all view modes while we limit view modes in our selection to the used ones and remove some technical ones.

So really no idea...

johnchque’s picture

Seems to be to have in diff a list of the view modes set for nodes. We can remove it as far as I can see. But this will make changes in getSelectedPluginForFieldDefinition, needs to be investigated.

ModernMantra’s picture

Status: Needs work » Needs review
Related issues: +#2811815: use per-bundle view mode as default for visual inline view mode selection
StatusFileSize
new3.88 KB
new2.48 KB

Had some discussion with @berdir, he suggested to create update config function and to create follow up (in revision section it should be loaded from settings view mode, as i understood :) ). Some small fies in patch and create update config function...

miro_dietiker’s picture

Status: Needs review » Postponed

Not sure about this all.
We should discuss and decide in the related issue #2810039: Diff for 'Sticky at top of lists' does not work
I want to test drive the system behavior if we drop all those view mode settings.

berdir’s picture

Even if we do remove the check that we have now, using this setting for the default view view mode in the visual diff might be useful as some entity/node types are really only used certain view modes. Not strong feelings, though.

miro_dietiker’s picture

Yeah i was also thinking about this. But we only have a node UI now.
Where would you put the diff view mode settings for the entity types + bundles?

miro_dietiker’s picture

Status: Postponed » Needs work

OK then, we need to rescope this issue...

There are 3 remaining pieces to do:
- Generalise the setting for entity + bundle
-- Offering a UI for other entity types
- No more considering the view mode for field plugin determination
- Use the setting for default visual inline view mode selection: #2811815: use per-bundle view mode as default for visual inline view mode selection

Not sure if we should do all at the same in one issue or how to split.

miro_dietiker’s picture

Title: Generalise content type diff setting » Remove content type diff view mode setting
Issue summary: View changes

Quickly discussed and simplified the situation:

We will remove the setting in a first issue. A quick solution that is satisfyying and removes complexity.

Then we can cleanly add the thing in a feature issue (currently low priority) when it is really needed.

ModernMantra’s picture

Status: Needs work » Needs review
StatusFileSize
new3.85 KB

Removed view mode filed, created update config function and fixed some tests. Let see the test bot...

johnchque’s picture

Removed the whole setting. Now using the default form display. :)

miro_dietiker’s picture

Status: Needs review » Fixed

Committed, awesome! :-)

Status: Fixed » Closed (fixed)

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