Weird hierarchical select requirement for Drupal - drupal

Anybody know of a module or other way to do a hierarchical select in Drupal that first pulls in a taxonomy vocabulary from which you select and then based on your taxonomy selection limits a CCK related node field to a specific content type.

AFAIK, there is no module that does that. A node reference field does allow you to specify a view as its source, but unfortunately, you cannot pass a dynamic argument to that view.
If you can figure out a way to take the selected taxonomy term and pass it to the view as an argument to filter the results by, you're done...
There is a start for something similar on http://drupal.org/node/473670, but that code fetches the dynamic argument on the PHP level from a GET variable. The behavior you describe should work on the Javascript level, because your argument is a variable selected on the form by the user.

Related

Drupal 8 Views Question Involving Entity Reference

Trying to figure out views relationships and filters.
I'm trying to make a view that has the title of the page match the entity reference of the same page and make it reactive so I only need one. EX.) Page about animals, which there are nodes referencing the animal page as an entity reference.
Firstly, you have to take one unique field which can identify whether particular node is for animals or etc.
After that, In your views you need to select that field name in contextual filter and select option as you can see in screenshot and then save it.

What is the syntax to add a column to the Custom Form list that shows where in WF it is used?

Super simple.
When viewing the list of Custom Forms in Setup, I want to add a column that shows where those Custom Forms are in use (or null if used nowhere).
This is similar in principle to viewing the list of fields, which has a list of forms on which those fields are used.
What is the syntax I can use to add the appropriate column(s) to the view?
As far as I know, there is no linkage in the backend that connects categories (custom forms) to their host objects. This is probably because the list could be massive and the query would take quite a while to execute as it would have to traverse every object in Workfront or each form would store every parent object ID.
Unfortunately, you can't even search for objects by associated category IDs, so if you wanted to build this yourself you would need to query each object and search its categories to see if your custom form appeared.

Drupal 7 and Views, contextual filters searching through multiple/combined fields. Is it possible?

I've worked with Drupal 7 and Views for a while now and I'm familiar with what Views allow by default and what is available as modular add-ons. Today I've come across an issue with Contextual filters, which allow you to pass in an argument via the URL and use this to filter the returned data.
Normal filters on the other hand can be exposed as a form and also allow for a field combination module which means we can search field{1,2,3} all at once and display the data depending on this input. (views_combined_fields)
Is it possible to tell Views to show me all rows (WHERE field1="test" OR WHERE field2="test" OR WHERE field3="test") but by default, if I add in multiple contextual filters only one of them is being triggered. In this example the "test" value is obtained from the url /data/test.
My problem is that users have a default group, but they also have the option to be added into other groups which are set in the field{1,2,3} fields. My current view shows all users WHERE group = "test" but I want users who have a secondary or tertiary group of "test" to also be displayed in this list.
As i understood, you are talking about Views Arguments, watch the tutorial video from
MustardSeedMedia.com. And useful video about Views 3 User Interface

A way to limit taxonomy exposed filter options in view with arguments in drupal

I'm building a product catalog where a particular section is displayed by views with an argument, a taxonomy id of a section.
But I also need to give user the ability to further narrow down the search by specifying the producer by choosing term in another vocabulary in the exposed filter.
I'm trying to limit the selection to terms for which nodes in a chosen section exist. Looks like the views_selective_filter and view_hacks are especially for that, but looks like out of the box neither of them takes into account the view argument. Is there a remedy or workaround?
Use Firebug or the devel_themer module to find the form ID of the form displaying those terms, then use a hook_form_alter in a custom module to intercept, and modify that form.
In the end I used views_taxonomy_selective_filter. I had to patch views module as I described in the comment in order to make it generate select options after processing arguments.

How to display and hide Drupal 7 fields, based on value of a specific field

What I am trying to do here is controlling how a group of fields are showing up on node view. I don't want to control them by user role, as this is going to be a node level permission and I don't want these permissions affect other nodes with the same content type.
For example imagine I have three different roles: ROLEA, ROLEB and ROLEC. Each role has it's own permissions set for accessing to fields. When a node is created for the first time, a user with role of ROLEA, can see couple of fields and can edit the value of those fields. When node is published, a rule/action get called through Rules module, and will set a status field in that node to STAGE1. After this event (a new node created), if user (ROLEA) goes to that node that was just created by herself, those fields that were editable before, should be read-only now. This means when Rules module, set the value of the status field to STAGE1, when that node wants to get loaded by Drupal, we need to check the status value, and based on that if it was for example STAGE1, modify some other field in that particular node, read only or editable, or in some cases hide them from user. So my guess is to create a module that every time a node of that type, is loading, check the status field (which is a field that we have created in that node type) and based on the value of that field, decide which node should show up or hide. This should override the permission that have been set for those fields on that particular node type.
What I am trying to do is creating a method to control which field is going to be read only /editable / hidden based on the value of a specific field in that content type, which has been set by Roules module, based on different stages of working on that node by different group of users. I am not using Organic Group. I use Drupal 7 and Rules module and couple of other permission related modules. But I found that there is no such a way to handle field visibility in node level, separate from user roles.
Do you think there is any other way to achieve the same result? I appreciate if you could give me an idea about how to create such a module.
I really appreciate any and all input.
You can create a module and add a hook on node form using : hook_form_alter or hook_form_FORM_ID_alter
Using this kind of hook, you can easily modify node form and hide or make read only specific fields, based on whatever you want (user role, field value...)
There are also the hook_node_view_alter() hook and hook_entity_view_alter() hooks that allow you to modify the render array for a node before it is rendered. There you can set field arrays to have '#access' = FALSE so they are hidden, or '#access' = TRUE to show them.
I'm using this to hide some fields if the date in another field of the node has a time in the past (it's a "subscription expires" field). So I didn't need to change the edit form, just the field display.

Resources