We want to create a page that shows two specific nodes.
The first node will be localized content (an article node in the user's language). There will be at least 5 different language versions of that page.
The second node will be a Webform node that the user can submit to "sign" the document. It will be language neutral.
Originally I figured that I could have one Webform node and then translate it into the appropriate languages. But what I discovered was that the "translated" version of the Webform node was, in fact, a completely new node--which means a completely new webform. This makes sense if you think about how Drupal handles multilingual content--each translation is a separate node.
But in the case of our webform, we don't want to split the submissions into 10+ different webform submission sets. Everybody who "signs" has their signatures placed into the same "bin" of data.
I can think of two possible solutions:
Create a page that will display two nodes: the localized version of an "article" node (selected depending on the user's language selection), and the webform.
Create multiple Webform nodes (one per language), and then create a MySQL view that merges all the user submissions into a single set of records. This would allow us to extract our data without a great deal of headache.
I'm not sure if 2 is possible. I'm assuming that I'll have to go with 1. But, so far my efforts to accomplish this have also been fruitless! How can I do this?
-Josh
I think 1 is much easy and possible solution. You can create webform node and make body field as php code (for that you need to enable php filter). And put in body follow lines:
<?php
$nid = NODE_ID;
$node = node_load($nid);
$node_view = node_view($node, 'full');
print drupal_render($node_view);
?>
Just replace NODE_ID with nid of multilanguage node.
Related
We have multiple e-learning modules under one domain.
We want to know how many new users start each module over a set period of time e.g.
trainingDomain.com/module01 > 4 new starts
trainingDomain.com/module02 > 2 new starts
trainingDomain.com/module03 > 5 new starts
The metric that seems to best fit new starts is new users by module.
We have tried various approaches but no success so far. I suspect we are misunderstanding something conceptual.
Each page in a module saves a moduleID to a custom dimension i.e. click scope. If we create a custom report with new users as the metric and moduleID as the primary dimension, only the first module visited registers in the report.
Does anyone have a suggestion of a better way we can approach this or a way to tweak the current approach to work? I'm really struggling to get my tiny brain around this...
Many thanks!
Actually, custom dimension is redundantly for your purpose.
Create a page content group with your modules. Then create a custom report with the new users as metric, page as a dimension and filter by your content group.
I'm trying to create a list of related articles in Drupal, based on shared tags. I've used this solution and it works great:
Creating list of similar nodes in Drupal 7/Views 3
However, I wish to expand on this and exclude certain nodes from the related view which are not relevant. I have a node reference field (field_exclude) for the article which allows the user to select which nodes to exclude.
I just need to update this related view to exclude any node ids found in field_exclude. Any idea on how I update the view to add this functionality?
Thanks.
Add a Filter Criteria for the field_exclude and there set the "Not empty" value or any other value that wil do the job.
Another solution here is to use the NodeQueue module where users can add nodes in lists/views.
I have taxonomy term with field collection field set to unlimited values. FC contains few texfield, textarea and image fields. FC and it's fields are set to be translated by user.
Taxonomy term is localized - all terms are the same for all languages just that they are translated. I have entity translation turned on for taxonomy term and node but not for FC because it trigers notice about not valid base path.
With this configuration: I create term and save it, after initial creation i can add any number of FCs and save them. On translate form I can then add translations for them. And when saved values remain saved for different laguages.
Problem occures when I create a view with relationship to FC, add FC fields and set contextual filter to termID (showing this view via panel on taxonomy terms). Field language stting is set to current user language. On views preview with manually set termID I see proper result for language in url (en/admin/structure/views..) and correct result if I change language prefix. But on term page it doesn't show anything.
I am using latest dev entiy translation an field collection modules.
I also tried setup with entity translation enabled for FC but again i don't get right output from views.
Where am I doing it wrong? FC setup, multilangual setup or in views. Does anyone have a hint how to make FC translatable?
I retested on clean installation. All this apply for what I described in #9 . Same result but some new/confirmed observations and possible workaround:
There is a bug in FC when translating fields for the first time values are not properly saved:
values are saved but when I refresh edit page, fields exist but are
empty/blank, fields on default language are ok
what really happens: when saving translation of FC fields, they are wrongfully linked to default language and not to translated one, also they don't show up when reopening default language so that they could be deleted. This can be bad if you accidentally catch them in a view as I did (for some time this was misleading me because titles were the same).
possible workaround: when first translating you have to delete values that are copied from default language and save it, then you can enter translated values
ET for FC enabled: same issue and workaround
After creating some content on terms and translating them with workaround, I tried to show them in panels via view.
I created a panel and set selection to taxonomy vocabulary I am using and under content I created "new custom content" in which I included some substitutions - for FC field %term:field_test_fc (this is my test content)
when I change language, values change accordingly to selected language
substitution renders all fields of FC and shows them in correct language
this is why this issue is bugging me… it should work on a view too because if term itself can distinguish between different languages of FC fields so can view via panel
I created view (page) in which I list all FC fields of all terms grouped by term name using relationship of that FC
content does change accordingly to the selected language =)
I created another view (content pane) as above and just added context filter, set it to termID and attach it to panels
view shows only FC fields of language that was used last when saving term. This mean that when editing and saving term in default language, view will only show fields of default language. weird :S
ET for FC enabled: it broke both views (showing fields of all languages everywhere), fixed by adding filter based on FC field: language and setting it to current user language
panels view still didn’t work as expected, but I knew that there was a problem with context filter
what I had to do is to remove validation criteria from context filter ( termID)
After solving last problem, view for panel is working and viewing term in both languages shows correct (translated) FC fields =).
Hope it helps understanding where problems occur and how to go around them. Fix would be nice though =)
Field Collections as a module has not yet been patched to support multilingual well. The debate is whether the field collection itself should be set to language-neutral, allowing the underlying fields to be language specific.
However, the field-collection module by itself does not currently support multilingual. There are a number of patches related to this on Drupal.org, including the following two major patch threads:
https://drupal.org/node/1344672
https://drupal.org/node/1316162
The Lingotek Translation module for Drupal 7 is successful at translating field collections and displaying them because it gets around the limitations of the Field Collection module using a combination of hook_entity_load, hook_entity_update, and a translation process that does not rely on the entity_translation module's UI.
I want to create a view that shows the latest posts in a forum and also any latest comments. The comments and the posts would all show in the same view. Is it possible for me to do this?
Thanks in advance,
Ben
In essence: no. Views requires you to choose one main resource in the first step: you there (amongst others) choose to go with either nodes, or comments.
However, with some (ugly) configuration, you can load the comments that go with nodes. Each result would look like, Node - Comment, e.g.:
Can I have cheesburgers - First!
Can I have cheesburgers - No, I was first!!!111oneone
Can I have cheesburgers - LAME.
and so on. With some styling, you can then get it to show comments and nodes in separate rows.
However, this is ugly and hackish. My advise: write a simple module that either exposes a block, or a menu+page, and do two simple (and light) queries on the database: SELECT nid, title, ... FROM {nodes} LIMIT 10 and SELECT nid, name AS title, ... FROM {comments} LIMIT 10 then mix these two up. Or, with some (more complex) SQL magic, you could even join the two tables and create fancy results that e.g. order by created date of either nodes or comments.
With Drupal 7 you can add a relationship Last comment and then add that field to the view.
One idea I've seen is to use Views Custom Field to "attach" a wholly separate view with PHP code. See comment #4 for the code (in a request for this feature in Views. for a code example).
How can i display content nodes in blocks depending on the selected language by the user?
I already know how to do it for 'normal' nodes, just not in blocks.
Edit: I tried to do this with views. Filtering on a node and content translation: language. The problem is, i don't know how to filter two id's (of the nodes), just one.
If you have created the nodes after each other, you can do it pretty easily, since you can query for a range of node ids.
The views UI doesn't support making OR in where clauses, so it's not easy to make a query that looks like this.
SELECT nid FROM {nodes} WHERE nid = 5 OR nid = 10 OR nid = 17;
Making OR is views have been asked a few times here, I've answer it here.