How can I filter node references to 'strictly own nodes' ? (Drupal 7) - drupal

On my drupal 7 site, I have a content type (artwork) that presents my users with a CCK field where they can specify what project (another content type) the node is referenced to (node reference module). The problem is that I can't seem to find a way to filter the options to 'own nodes only', so all the projects of all the users show up it in the list, and any user can just push his nodes on the nodes of another. I can still filter these nodes out with views on the output of the project node, but it's not very clean on the add/node form.
I found a module that is called 'CCK reference filter' that sounds like it should handle this situation, but it's not ported to Drupal 7.
So far I've gone pretty far without having to touch template.php and using hooks, and I would be very relieved if I wouldn't have to, since I'm hardly a php wizard... But if someone has any suggestions! Everything is welcome
Have a good day!
Bruno
(this is my first post here by the way, please tell me if I'm in the wrong place or anything)

The way to achieve that in Drupal 6 was to use a Views to filter the node that you can reference.
The goal for References module in Drupal 7 is to strictly have the same functionality as the D6 module. But References is still in developpment and it seems that this has not been implemented for now.
This issue seems to be very similar to what to want : http://drupal.org/node/1034042

Related

Drupal know from where things are showed

I have a strange question but I don't find any hint about that (if it's possible), for a drupal 7 website I have to modify some content of a page in the backoffice, but I really don't know from where some content of this page is created (a table, similar to a view table but not a view table).
I just want to know if there is any way to show which php function the page use to finally be showed. I know there is something like that for the theme (drupal theme debug) but I don't find something for my case.
Any idea ?
You need PHP profiler to check all functions called on page, there's a module for Drupal7 for XHProf integration. But I would suggest you to use your browsers inspector as mentioned by 2pha before. For example if there's a form on the page just use the form ID to find it. Custom classes are very useful in these cases, parts of the html codes etc. In your case search for table headers...
The code you are looking for is most probably in custom modules and the
general suggestion is to keep you custom modules in separated folder from contributed ones.

Is there the equivalent of the WP plugin Types for Drupal 7?

So I have a Drupal 7 client who needs to have a dynamic content type...
name, description, 3 images
We will show these "objects" (for lack of a better word) in a filterable grid. Also, the client needs to be able to add, update and delete these on their own.
I have done this sort of thing many times in WordPress with the plugin called "Types" (https://wordpress.org/plugins/types/).
Is there an equivalent plugin for Drupal 7? If not, any thoughts as to how I would go about this?
Thanks,
David
One of the great advantages of using Drupal is that it is a framework for creating custom content types very easily using the administrative interface. See this for further reference and good luck!
http://m.linuxjournal.com/content/creating-and-theming-custom-content-type-drupal-7

Plone: Master Slave Widget

I'm looking for a way of displaying two select fields A and B, where B depends on the selection made in A. For example: Assuming A is a select widget for displaying countries in the world, then B should only list those cities that are found in the country selected in the A field.
I intend to use this in a custom content type and hopefully create a search filter in my view template as well.
Does Plone has such a feature? I've taken a look at Products.MasterSelectWidget but it is very old and it is not compatible with Plone 4.2.
I'm thinking I may have to do this manually using ajax.
Any ideas?
If you are using Archetypes framework, MasterSelectWidget is still the answer for you needs.
You say that it's not working with Plone 4.2 (I never tested) but probably it needs only few fix to back working. Don't be scared from the fact that the product is old... Archetypes framewrork didn't change much in last years!
Just in case, if someone is looking for such widget with Dexterity framework. There is plone.formwidget.masterselect : https://github.com/collective/plone.formwidget.masterselect

Multilingual drupal website with views

I'm trying to make a multilingual website in Drupal. My languages that I need are german, dutch, english and french. I've added the i18n module and added the languages.
I work with views to show my content on the website. For the moment I have one page that I want to translate in the 4 languages. I've created a view for each translation. Now I want to link my view to the correct node. Therefore I use a view field in my content node.
PROBLEM:
My problem lies in the url. The first time everything is fine.
my url: localhost/?q=nl/activiteiten
Now when I select english in my language bar the language changes but not the url. my url: localhost/?q=en/activiteiten
Here "activiteiten" must be "activities". How do I solve this?
I've searched a while for this problem on the drupal forums but I can't seem to find a good solution to this problem. The only thing I've found is working with a view field in the content node or with input_views in the body of your node. These two won't work for me.
i18 module with no need to create a view for each
language, you have to translate content using the i18, then
charge between changing the language.
You can have problems from the beginning did not use the module
all languages ​​declared, you have to edit each
content and save it to associate it well.
Well, just reading your own answer I think you've taken a wrong turn somewhere (or you're trying to do something else and I didn't quite catch on).
To create multilingual views for pages (which is what I think you want to do) you would first create a page view (duh), specify what you want to be shown and define a path to it. Then you enable (if it's not enabled already) the URL-alias ("URL-aliassen") module and define aliases for each language (ie. FR : activites - I don't like accents in URLs :p - NL : activiteiten, DE : aktivitaten - if memory serves me right anyway, again with accents removed :p). These aliases will be used as the path from that moment on.
For an article describing this process refer to : Translating Views paths in Drupal.
BTW You could also use the Pathauto module to create these aliases based on the title of your nodes of course instead of defining them manually, you can even (re)create them in batch when you alter the settings.
Eventually I've solved my problem with a view field. I've made my view and in my node I've selected that view in the list. Then in the body you can type something for that language.

Migating from CakePHP to Drupal, functionality question

(I've posted this on the drupal forum too btw)
I'm converting the company websites to use Drupal, or at least trying to check that its going to be the best way forward. I have a background in PHP development, and I'm currently using the CakePHP framwork. I've built this site (not my design) and I can see how to replicate most of the functionality using Drupal, most likely using the CCK module.
http://preview.tinyurl.com/yk6u8mt
As you can see from the homepage:
A user chooses a country.
The country is passed using an ajax call to a script that decides which phone is best based on 'in country' network coverage.
A div is shown recommending the visitor the best phone for that country.
I'm wondering how to go about this in Drupal, I'm definitely not after a step by step guide, I just want to know if this kind of thing is possible with Drupal, and what approach to use.
If someone can help that would be superb. Thanks.
Okay, so you've got a path you're defining in hook_menu, which is where your form is being presented - or else you've got it set up as a webform in a node, that could work too.
Either way, in your form you're going to be using AHAH - check out http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#ahah and http://drupal.org/node/348475 .
Basically, you're going to define another path in hook_menu that's of type MENU_CALLBACK, and which will receive the country as input, and then will return the div that you'll display on the screen.
One core example of AHAH that may be useful to you is where you're entering a password and it lets you know if the password is secure enough - check that out.
Edit: There's also some good examples at http://drupal.org/project/examples.
I would look into using CCK and views. you can set up filters for the views. If filters don't work, you have the ability to include php code. I have also successfully added jquery code in the header of a view through which I was then able to have my view filtered by what is typed in a text box.
Coming from CakePHP using Drupal is a pain in the a** - even more for developers.
It's application structure might be designed to ease extensibility but this only means you have a system to enable your own plugins and themes.
While modules are basically the M+C-part the themes are the V-part of an MVC-application. The problem is that this seperation is not very strict in Drupal - in fact you have to break it sometimes in order to make things work (e.g. you have to include a theme_mymodule_myfunction() into your module as default output which you then can override with your theme using mytheme_mymodule_myfunction() ) And don't even bother looking for classes ( see http://drupal.org/node/547518 ).
Also there is no real link from a module to a theme. On many occations this is a good thing as you can switch modules and themes seperatly without creating a problem. For application builders coming from CakePHP (or any other framework) you often feel a lack of "wholesomeness" - you create parts for a base software and have to live with it's drawbacks.
IMHO I wouldn't recommend this step. Drupal is fine if you have to manage a website and might add a few modules to add neccessary value (image gallery etc.) but I definetly don't recommend it as a base for a customized web-app.

Resources