I have a content type with a node reference field biblio attached to it for this which can have multiple values selected. Now I want to attach a vocabulary (term reference) named languages attached to each selected value of the node reference field. I need a solution that will make it easier to manage the database side as well as the widget for the field.![enter image description here][1]
On the left we have list of nodes with their IDs and check box to select each node. What I want to do is, add check boxes to select one or more languages to be attached to the selected node. For this I created a vocabulary named languages but there does not seem to be a direct way to do this using references or entity reference or any of the available modules.
One way would be adding language field to vocabulary it self.
But if you want to allow admin to select term and language while editing nodes in your content type use field collections:
https://www.youtube.com/watch?v=1V1ofpgUw-Y
https://www.drupal.org/project/field_collection
Related
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.
Premise: I'm new in the world of Drupal, so sorry if this is a stupid question.
What I need is to set some relationships for some new content types I created. For example, I created the "Person" content type and the "Group" content type. Using the "Relation" module I have defined the relation "is in", but now if I want to add a field for setting the relation at creation time, there are no edit widget available. The only way I found to set relationships is using the entity collector: too complicated for a user.
Example: a user creates the Person "John", and he want for him to set the relation "is in" with the Group "Drupal fans". So, during the creation of this Person he needs, for example, a select control that lets him to choose from all the groups already registered in the site.
In brief, I need to manage some entities created by me, with CRUD controls, list, etc. and I need to set some relationships from these entities.
What is the best method/ what are the best module/ how I can do this?
Try the references module: http://drupal.org/project/references
You can create an taxanomy list of your'e groups at Structure -> Taxonomy.
This list you can use in creating an field. By the creation of the field choose for "Term reference" type and then "Autocomplete term widget". Click on save and choose the Taxonomy list that you created.
Hope this is what you need!
I need to sort my view by a specific field that is actually a node reference field.
For some reason, however, the node reference field does not appear in the sort criteria list.
Is there any reason for that? How can I solve this problem?
You can't sort by a node because Drupal wouldn't know the criteria for sorting a node to say which is first and which is second, etc.
I assume you mean that you want to sort by some field (like the title) of a node that is referenced.
To sort by a field in the referenced node, you have to the referenced node in a relationship to join the tables. Them you can simply add a sort by 'title' field but be sure to select the correct relationship under the Relationship drop down when you create the sort field.
I am trying to create a schema in SDL Tridion to satisfy these requirements.
I have two main fields:
ABCD, which has one sub field as "XYZ"
AAAA, which has two sub fields namely "Name" and "Value"
Both main fields are repeatable and and should be movable.
Example patterns may look as per requirement:
ABCD----AAAA----ABCD---AAAA
AAAA----ABCD----ABCD----AAAA
The main fields AAAA and ABCD should be moved from one to another.
Say if I create a component with the created schema and the first main fields as "AAAA" and second field as "ABCD", then I should be able to move ABCD above the AAAA.
I have tried creating an embedded schema with two fields:
select Main field: As a list, where I select either ABCD and AAAA as a TEXT type.
Text: enter the text.
Added this schema as part of content schema as multivalued which allows "reposting and repeating".
Problems facing:
As the fields are not common to both main fields, I am unable to enter the data for it and the common subfield for both main fields doesn't satisfy the need..
Solution Needed:
If I create two embedded schemas with the names "ABCD" and "AAAA" with the required fields, can I add these schemas as part of drop down in the main content schema?
If user selects embedded schema "ABCD", it should display only "XYZ" field. If user selects "AAAA", i should display its subfields as "Name" and "Value".
If this is not feasible can you please suggest the best possible to solution to meet the requirement?
I am using DWT TBB and XSLT TBB for rendition part.
Thank you.
I don't believe this is supported using the out of the box SDL Tridion Web Schemas (Although a number of great undocumented schema changes have crept into the product lately) . Tridion Web Schemas use a sequence in the XSD to control the order (and numbers) of the fields which prevents you from having a multi-value field with two types of Embedded Schema. You could however use a complex schema (i.e. model your data yourself by designing your own schema or modifying one you built using the GUI using the source tab), but would likely longer be able to use the GUI to edit your content.
Is there anyway you could use a multi-value Component Link field rather than an Embedded Schema? That way you can link the field to items of type AAAA or ABCD and put them in any order you want.
If you want to stay within the realm of Tridion Web Schemas this is indeed not possible. As Chris explained, if you start using a Complex Schema for this, you loose the form based UI for editing a Component.
Only solution I can think of is to add all fields of ABCD and AAAA to an embeddable Schema and make everything non mandatory. If content validation is important, then you can implement an event system which does the check on save of the Component. In here you could do conditional checks, if the fields form the ABCD part of your embeddable schema are filled it will ignore or can even clear the AAAA fields and vice versa.
Your template code will now need to make the decision on what content to show. If all of the fields on the embeddable schema are filled, it needs to make a choice on what to show, otherwise it can show just the content which is entered. You should make the logic of the template clear in the field description of the embeddable Schema, so you can guide the Content Editor into what content is required in which scenario (supported by an event system on save to validate the correctness).
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.