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

[UX] Layout visibility conditions: Vocabulary names not updated unless cache cleared. #3242

Open
klonos opened this issue Aug 4, 2018 · 2 comments · May be fixed by backdrop/backdrop#4744

Comments

@klonos
Copy link
Member

klonos commented Aug 4, 2018

Describe your issue or idea

I have noticed this while testing #3033 and #3241. This problem happens with taxonomy vocabularies, but not with content types...

Steps to reproduce (if reporting a bug)

  1. Create a layout with /node/% as path.
  2. Click "+ Add visibility condition" and select "Node: Type" -> the "Page" and "Post" content types are listed.
  3. Select both of them, and save the visibility condition -> in the visibility condition summary, the content types are listed as "Page" and "Post".
  4. Navigate to /admin/structure/types/manage/page/configure and /admin/structure/types/manage/post/configure and change the name of the content types to something else (lets say "Simple page" and "Article"). Save -> you are redirected to /admin/structure/types where you see the updated content type names names 👍
  5. Go to /admin/structure/layouts -> the label of the content types in the "VISIBILITY CONDITIONS" column is showing the new names "Simple page" and "Article" 👍

...

  1. Create a layout with /taxonomy/term/% as path.
  2. Click "+ Add visibility condition" and select "Taxonomy term: Vocabulary" -> the "Tags" vocabulary is listed.
  3. Select the "Tags" vocabulary, and save the visibility condition -> in the visibility condition summary, the vocabulary is listed as "Tags".
  4. Navigate to /admin/structure/taxonomy/tags/configure and change the name of the "Tag" vocabulary to something else (lets say "Categories"). Save -> you are redirected to /admin/structure/taxonomy where you see the updated vocabulary name 👍

...

Actual behavior (if reporting a bug)

...

  1. Go to /admin/structure/layouts -> the label of the vocabulary in the "VISIBILITY CONDITIONS" column is still shown as "Tags" 👎
  2. Clear caches -> the label of the vocabulary is now updated to match the new name that you changed it to in step 9 above.

Expected behavior (if reporting a bug)

...

  1. Go to /admin/structure/layouts -> the label of the vocabulary in the "VISIBILITY CONDITIONS" column is shown with the new name that you changed it to in step 9 above, and no clearing of caches is required.

PR by @klonos: backdrop/backdrop#2355

@klonos
Copy link
Member Author

klonos commented Nov 5, 2018

I have filed a PR that clears entity info caches when loading the layout list in /admin/structure/layouts, and also the layout add/edit form, and the layout visibility condition dialog.

I was unsure if I should be clearing all caches or not. I ended up using entity_info_cache_clear() instead of cache_clear_all(), as it seemed less "expensive". WFM 😉

@stpaultim
Copy link
Member

@klonos - I am looking at old issues and found this old PR.

I confirmed the problem using the exact steps to reproduce provided by @klonos and verified that after applying the PR things work as expected.

The PR was WAY out of date and there was no sandbox. I recreated the PR using the exact code previously provided by @klonos for easy testing.

This is a pretty simple thing to test and a pretty simple PR to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants