Hi,

is there some kind of documentation on how to use this module?

Regards,

Tobi

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

manuelBS’s picture

I am also not getting it working. How can I start using this module?

sinasalek’s picture

Same question here

manuelBS’s picture

For a work arround, I am using https://drupal.org/project/reference_option_limit for entity-references. This module has limited functionality but for entity references it works very good.
Looking forward this documentation.

nhck’s picture

Example usage:

  1. Enable both modules.
  2. Create a view with:
    • An entity reference display
    • Input/Contextual filter: Your argument-field type, e.g. if you pick from a list of nodes - the content id
    • Output: A list of items you would like to reference to e.g. taxonomy terms
  3. Create two fields
    • Your argument field of whatever type you expect for your entity-reference (e.g. nodes) view (Cardinality of this field must be 1 as of now - feature request is pending)
    • For the dependent field create an field of the type Entity Reference; for the entity selection choose Views: Filter with an entity reference view with dynamic arguments as a selector (Note: This is the view that will take your contextual argument, if it doesn't appear on the list the target type doesn't match)
    • Below this field you wil see a list of Dynamic arguments; these are possible argument fields. If your field is not listed. Check the cardinality and type of this argument field.
dburrueco’s picture

Issue summary: View changes

Thanks for the example, but I'm missing some info...
I'm trying to implement a form that lets you choose a course category and, depending on your choice, a list of available courses (you can see this in www.edutheca.com), and the results I'm getting are not exactly what I expected. Any idea of when you'll have that documentation finished. I've been trying to get this work for hours and this example you give is the most complete information regarding this module I've found.

maximpodorov’s picture

You use multi-select widget, and this doesn't work correctly. I hope to fix it soon.

agileadam’s picture

This module works really well. Thank you for it.
I do, however, agree that a little documentation would really go a long way.

agileadam’s picture

Also, a better description on the project's landing page would surely increase the number of installs.

Something like this:

This module adds an additional "Views: Filter by an entity reference with dynamic arguments" entity selection mode for entity reference fields. The dynamic arguments are derived from other fields in the entity. You can add contextual filters to your entity reference view as needed.

For example, let's say you have US states and US cities. Your "state" content type is very simple, with just a title field. Your "city" content type has a title and an entity reference pointing to your "state" content type. You can configure the entity reference field to use the new "Views: Filter by an entity reference with dynamic arguments" mode. For the "view used to select the entities" you would have a "Cities" view with an entity reference display. This would have a title field and a "Content: State" contextual filter (the entity reference field) configured to "Hide view" when the filter value is not available.

fruitsalad’s picture

Hello,

I am trying to realize the following scenario.

In a node I got two fields.

- Field "Club" -> Entity Reference -> shows the the Organic Groups of the user with type "Club"

- Field "Team" should display the teams of the club the user has selected in the first field.

Is there a way to realize this with this module? Or is there another way to achieve this?

Thank you all for your help!

maximpodorov’s picture

This module is exactly for this scenario. Field "Team" must be entity reference with "Views with dynamic arguments" selection.

fruitsalad’s picture

Hello,

thank you for your answer. Do you know what contextual filter I need to apply to get this working?

The Club field is an entity reference with target type node. entity selection mode is organic groups.

For the team field i used entity reference also with target type node. entity selection views: entity reference with dynamic arguments.

The view displays content of type team. The preview of the view shows, as it should, all content of type team.

What do I have to put into the contextual filter to show all teams that are content of the club selected in field club?

Thank you all for your help

maximpodorov’s picture

You should create contextual filter which accepts Club node ID. This filter will be something like "Group from group content", I don't remember exactly the OG names for this.

fruitsalad’s picture

Thank you very much for your help! Do I need to configure the contextual filter? What I mean, do I have to provide a "default value" or something like this?

How does the view with dynamic arguments know where to get the group id?

I integrated the two fields in a content type "friendly match". There the user selects one of the clubs he belongs to. By this selection the team field should display the teams of the choosen club.

Clubs are the root group. In the club groups the users can create team groups.

I just cant figure out to get this to work...

indigoxela’s picture

Hi,
also struggling with og and ddf...

As public static function settingsForm in EntityReference_SelectionHandler_DDF.class.php filters out anythind except "options_select" and "options_buttons" and og uses "og_complex", we don't even see the og audience field in the help section for Dynamic arguments.
The token we would use is {og_group_ref} (with curly brackets).
Arguments get set with this token.

The next problem is, that dynamic update of target field values won't work. Possibly dep_selectors don't get set properly for og fields.

My conclusion: ddf is not (yet) compatible with og.
Could og compability be a feature request?

nithinkolekar’s picture

where should dynamic tokens be placed?
in my setup

The following dynamic tokens can be used as view arguments:
{field_year_test} - year test

is showing and couldn't get where {field_year_test} has to be placed?
ok got it. It has to placed with in "View arguments" field.

update:
before creating new issues I need to get clarification about setup..
1. is sub module ddf_entityreference fully functional?

2. Is it possible to have both argument field and dependent field (views selection) is of type entity reference and both field's widget type set to "select list"?

3. Dependent field is of type entity reference with widget set to "select list" and cardinality is set to 1. With this setup dependent field is not populating but on dpm() on some variable like $limit, $result (function getReferencableEntities) is showing some data but $limit is 1 making views output to only one row while in view's preview it is working fine with outputting multiple rows just as configured in views. Even though dpm() shows one rows present in $result variable dependent field select list is not populating.

tistou’s picture

Hello,
I would really appreciate documentation or help.
I have installed and enabled module
Created view and fields.
However, when I edit the dependent entity reference field, I only see two entity selection options:
Simple (with optional filter by bundle)
Views: Filter by an entity reference view

There is no Views: Filter with an entity reference view with dynamic arguments option.
I must be missing something very obvious?
Thanks for the help!

maximpodorov’s picture

Did you enable both modules from DDF package?

Ivan Ottinger’s picture

Thanks for a perfect module.

@maximpodorov is right - there are two modules in the package. You need to enable both of them: DDF Entity Reference and Dynamic dependent fields. :)

njbarrett’s picture

This module would be way more useful if it had some documentation. Even just a 1 page basic setup. Right now I have no idea how to approach this.

Konstantin Komelin’s picture

Hi guys,

I'm going to write basic documentation for this module if nobody minds.

-- Konstantin

Konstantin Komelin’s picture

Here is my starting point https://www.drupal.org/node/2532790 Feel free to improve this document.
@maximpodorov please set this doc as an official project documentation through the project settings.
And I'm going to provide a patch with README.txt

Konstantin Komelin’s picture

Assigned: Unassigned » Konstantin Komelin
Status: Active » Needs work
Konstantin Komelin’s picture

Here is the patch that adds README.txt
Please review.

Konstantin Komelin’s picture

Status: Needs work » Needs review
Konstantin Komelin’s picture

Assigned: Konstantin Komelin » Unassigned
njbarrett’s picture

Thanks for your work here Konstantin.

I think your documentation is a great start.
I had a play with the module today - one thing I noticed that wasn't clear is the module only works when the argument field is using the option_select widget, otherwise the field does not appear in the list of dynamic arguments on the dependent field. It would be great if the docs highlighted this too.

Konstantin Komelin’s picture

Thanks @njbarrett,

People also mentioned that ddf doesn't work with autocomplete fields, checkboxes/radios, etc.

so I agree to add information about supported widgets to the doc. It's important.
Feel free to do it. I'd suggest adding something like "Limitations" section (H2 tag).

Best,
Konstantin

maximpodorov’s picture

Thank you, Konstantin.

Konstantin Komelin’s picture

My pleasure, Maxim.
Could you please review my patch? https://www.drupal.org/node/2095179#comment-10115928

And here is one more request to you https://www.drupal.org/node/2095179#comment-10115838

maximpodorov’s picture

OK.

njbarrett’s picture

@Konstantin
I have added the limitations to your document. Thanks again.

Konstantin Komelin’s picture

Perfect! Thanks Nick.

nithinkolekar’s picture

on Limitations .. is it applies to source/dependent element or both?

njbarrett’s picture

@nithinkolekar, I believe both.

Konstantin Komelin’s picture

@nithinkolekar, njbarrett I think so too.

maximpodorov’s picture

Status: Needs review » Fixed

Konstantin, thank you for the patch and the documentation. Could you analyze the comments in the current issue and add the requested info to the documentation page?

Konstantin Komelin’s picture

Thanks Max,

Unfortunately, I don't have time for this.
Moreover, I believe you as the module author better know how module works now and how it should work.

Best,
Konstantin

nithinkolekar’s picture

Title: Documentation missing » Documentation missing for Dyanamic Depenent Fields

changing title for search engines and for user dashboard.

nithinkolekar’s picture

Title: Documentation missing for Dyanamic Depenent Fields » Documentation missing for Dyanamic Dependent Fields

err.. typo

Konstantin Komelin’s picture

Title: Documentation missing for Dyanamic Dependent Fields » Documentation missing for Dynamic Dependent Fields

)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Richard15’s picture

Still not able to make it work, I don't know what I'm missing. In the view there's some particular setting could I forget?
Any little help will be much appreciate, thanks!