Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Display Settings Tab also respect user selected View Modes during Edit/Creation #144

Closed
DiegoPino opened this issue Mar 18, 2021 · 1 comment · Fixed by #163
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@DiegoPino
Copy link
Member

What?

This an enhancement of the new functionality/Service that #122 brought to us.
The new service is great and adds much more clarity to users wanting to see exactly which current View Mode is active.

If the user applies a View Mode during edit, forcing a View Mode over the computed hint this code there

function format_strawberryfield_entity_view_mode_alter(&$view_mode, Drupal\Core\Entity\EntityInterface $entity, $context) {
if ($entity->getEntityTypeId() != 'node') {
return;
}
if ($view_mode != 'full') {
return;
}
$view_mode = \Drupal::service('format_strawberryfield.view_mode_resolver')->get($entity);
// To be determined if we want to be dependat on ds module or not
// if so we really want to act on this alter and not the general one.
/* \Drupal::moduleHandler()->alter('ds_switch_view_mode', $view_mode, $original_view_mode, $entity); */
}

Respects it, but the "Display Settings Tab" will keep showing the Best candidate making it a bit confusing for enduser. We probably want to check if there is an override by the user and use in that case the selected View Mode.

It would basically the same as the alter:
If not 'full' then check
"ds_switch" => array:1 [▼
"x-default" => "search_index"
]
and use that value?

I will write a tiny tentative Pull and will ask @pcambra to review it and @alliomeria to test. Open to discussions. I just noticed this yesterday

Thanks!

@DiegoPino DiegoPino self-assigned this Mar 18, 2021
@DiegoPino DiegoPino added the enhancement New feature or request label Mar 18, 2021
@DiegoPino DiegoPino added this to the 1.0.0-RC2 milestone Mar 18, 2021
DiegoPino added a commit that referenced this issue Jul 12, 2021
@alliomeria this should do it. For the sake of time i will add this with 161 in a single commit since this also adds Markdown (and so many other things) and solves #144

This forces two permissions to be OR -ed. Means either Content: Administer display or Add, edit, and delete custom display modes. Wonder if that is enough? Or should we just go for the first?
@DiegoPino
Copy link
Member Author

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant