1

I use Drupal 7 and entityreference module. I have a content type with a entity refenrece field to users called field_users_referenced.

So I created a view with views module and list nodes of thats content type. I want to order this views result based on field_users_referenced.

when I add field_users_referenced field on filter fields, and set it for exposed filter , after type a field_users_referenced value on thats field, have no any result.

I do not want to filter field_users_referenced with select box, I want to type value on exposed filter field and order results.

please help me.

3

Advance View Settings -> Add Relationship -> Select Entity Reference Field

Then in filters -> add Filter-> Select field from the respective entity.

Thanks

1

You have to add your entity reference field as a relation to the view, and then you can use the fields from the User entity type in you filter section and configure it/them as you please.

1

In Drupal 8, you can do one of the following. These are in order from more recommended to less recommended:

  1. Apply the latest core patch from Generalize TaxonomyIndexTid filter to be available for all entity reference fields (unless it's been committed by the time you're reading this),
  2. Use the Entity Reference Exposed Filters module, or
  3. Follow the instructions in Entity reference filter with Drupal 8, which require custom code.
0

Based on of the @Colan solution. Add the following Patch to your composer.json file

"extra": {
    "patches": {
        "drupal/core": {
            "View Entity Reference Field" : "https://www.drupal.org/files/issues/2019-12-24/drupal-generalize-taxonomyindextid-filter-2429699-277.patch"
        }
    }
}

then run composer install and Rebuild the cache.

  • This answer assumes that the same patch should always be used, which I don't recommend. As per my answer, you should use the most recent good patch listed in the issue. If would be nice if you were to edit my answer to include this as a template, making it clear what should be changed depending on the patch (instead of posting this answer). – colan Jan 14 at 22:31
0

There is another way for Drupal8. Try using the verf module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.