Mentioned in #1801304-316: Add Entity reference field Task B.

Problem/Motivation

Cannot figure out how to add a context that will get default argument of nid's translation's language (from the url) and use that to filter a list of users by those users who have the same langcode in their account language setting.

Proposed resolution

?

Remaining tasks

It may not be possible. See what Tim or Daniel says.

User interface changes

N/A

API changes

N/A

CommentFileSizeAuthor
#9 view.txt5.35 KBYesCT
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

YesCT’s picture

Here are notes from a poor first attempt:

  1. add view. name: language user list
  2. show: users (meh, cannot pick default sort by name.)
  3. Save and edit
  4. add entity reference display
  5. notice error and click the format settings link.
  6. check user name and click apply.
  7. preview lists all users.
  8. add filter criteria: User: language. click apply (all displays)
  9. operator: is one of
  10. language checkboxes.. want to pick, get default from url or something. dont see that. click more collapsed field set, but that's just administrative title
  11. try not picking any checkbox.
  12. click apply.
  13. get error: No valid values found on filter: User: Language.
  14. add sort criteria: user: name
  15. click apply
  16. click rearrange in sort criteria drop button. put user: name (asc) first.
  17. click advanced
  18. click add next to contextual filters. try global null.
  19. pick provide default value
  20. try type: content id from url
  21. (advanced column keeps staying collapsed)
  22. go back to filter criteria user: language

maybe I dont want to list users. Maybe I want to list content, and then the language and then a relationship to users with that language?

dawehner’s picture

Assigned: Unassigned » dawehner
Category: support » task
Issue tags: +VDC

So there is for sure a limit what views can do out of the box.

The approach with using somehow a listing of users and try to use default argument is the right approach, though we need a new default plugin which could be called "node language from url". I'm happy to write one of those plugins.

YesCT’s picture

@dawehner if you write in words how to write a plugin like that, me or someone else can try and do the task. Maybe there is some documentation to point us to?

dawehner’s picture

Just a general question: Do you want to list all users, which have configured a certain langcode, which is the same as the langcode from the current node?

YesCT’s picture

Yep.

Thinking back, I was testing the entity reference addition and wanted to see if with worked with multilingual.
I think I was imagining that I wanted to fill in some (reference) to a user, and wanted to use language to limit all the users on a site, to just those users with the same language (default language setting) in their account as the language of the node being edited.

But I imagine, that something similar would be involved in making a block of 5 users for display with a piece of content, if we wanted to limit the list of users to those that had selected the same language as the content was.

YesCT’s picture

Actually, thinking more.. are users... do they have a "language" associated with the actual user, not their setting of what they want the default language of content to be is... but the language of the user thingy itself... like the language of the profile.

Say a user has a job title field. That user can write the name of their job title there, and translate it. So the 'user' itself might exist in one language and their might be translations of that user too.

We can probably come up with a reason to want to filter users by that kind of language also.

dawehner’s picture

Issue summary: View changes

@yesct
Is this issue still relevant?

Gábor Hojtsy’s picture

YesCT’s picture

FileSize
5.35 KB

I went back again, and still could not figure out how to make a block of usernames whose preferred language was af, when viewing a translation of a node into af: af/node/1

"language of the content" seems to always be english... from the context? (views ui preview) maybe it is just the preview!
tried saving and viewing the block placed in the sidebar of a en node translated into af, and an af node translated into en
this exported block seems to work.
but does not use entity reference.

maybe I'm not sure how to use an entity reference view anymore... I'll think on it. for now. here is the view block export.

YesCT’s picture

I added an entity ref display view to the view, I added an entity ref field to the article content type, picked user, and selected the ER view for the field. but when editing node/1/edit (or af/node/1/edit) the ER field autocomplete does not complete, the spinny wheel does not spin.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Lendude’s picture

Status: Active » Closed (won't fix)

Reading back, #10 might have been a symptom of #2910501: Reference method "Views: Filter by an entity reference view" is broken or something like that, the entity reference field should work now.

I don't think you can build the requested View out-if-the-box, as @dawehner pointed out in #2 you would need a custom default argument plugin for that probably. But adding that seems like something we shouldn't do for this, seems a bit limited in scope to add to core.

Closing this as "won't fix" for now, feel free to open this back up if you think there is still value to changing something in core.

Thanks!