Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #N
Problem/Motivation
Local tasks for "Manage display" and "Manage form display" are only visible on Field UI routes
Proposed resolution
Fix \Drupal\field_ui\Access\FormModeAccessCheck
and \Drupal\field_ui\Access\ViewModeAccessCheck
Remaining tasks
User interface changes
API changes
Original report by @aspilicious
Look at the screenhots, the tabs change when I click on one of the tabs.
Comment | File | Size | Author |
---|---|---|---|
#13 | 2142553-12.patch | 2.17 KB | swentel |
#13 | 2142553-12-test-only.patch | 677 bytes | swentel |
#11 | 2142553-11.patch | 1.5 KB | swentel |
Screen Shot 2013-11-23 at 12.02.37.png | 82.22 KB | aspilicious | |
Screen Shot 2013-11-23 at 12.02.21.png | 81.78 KB | aspilicious |
Comments
Comment #1
aspilicious CreditAttribution: aspilicious commentedHappens on any entity apparantly
Comment #2
swentel CreditAttribution: swentel commentedComment #3
alphawebgroupthe problem is in object to array conversion in those functions:
entity_get_form_modes()
entity_get_view_modes()
Comment #4
alphawebgroupi think it's critical issue after #2111823: Convert field_ui / Entity local tasks to YAML definitions is resolved
Comment #5
tim.plunkettThere's no problem with entity_get_form_modes() or entity_get_view_modes() here.
The problem is in
\Drupal\field_ui\Access\FormModeAccessCheck
and\Drupal\field_ui\Access\ViewModeAccessCheck
When on a path like
admin/structure/types/manage/article/display
, it uses the route from\Drupal\field_ui\Routing\RouteSubscriber
, which has the 'entity_type' added to the $defaults. But when on a module defined route likeadmin/structure/types/manage/article
, it does not have the entity type specified, and those access checks fail immediately.Comment #6
tim.plunkettComment #7
alphawebgroup@tim.plunkett
it fails on any path after the cache flushing
also, it sets a wrong cache value to "entity_view_mode_info:en"
that value wouldn't be unserialized next time
Comment #8
alphawebgroupahhh, yep, understood...
please ignore my #7 comment
Comment #9
swentel CreditAttribution: swentel commentedThis fixes it for content types, accounts and taxonomy vocabularies.
Comment #10
tim.plunkettThat's one way to fix that, but how would you know to do that? Only Field UI needs it.
Comment #11
swentel CreditAttribution: swentel commentedRight, different approach, works fine too.
Comment #12
tim.plunkettThat is *much* better! Now we just need tests.
Comment #13
swentel CreditAttribution: swentel commentedComment #14
amateescu CreditAttribution: amateescu commentedThe test and the fix looks good, sorry for breaking this :)
Comment #15
dawehnerThis fix makes totally sense.
Comment #17
webchickNice catch!
Committed and pushed to 8.x. Thanks!