How can I find the name of a certain field in my Drupal 7 view? For example I'm trying to find the event date field name in this view so that I can use it in my template file.
Thanks.
You can hover over the field name on the view edit page and you will get the field machine name at the bottom left corner of your browser screen.
But what you should really do in my opinion is download and enable the Devel module and add dsm($fields); in your template that will output all the fields available and their structure.
Related
I am Newbie to Drupal. I want to create a plant taxonomy website to my college. Here I add a image field with description field inside field collection. It displays inside a new page. But I want to display field collection data in the same page in place of the link(field_parts_of_plant 0).
Here the image for your reference
Help me to do this!!!
It works fine after adding "reference table formatter" module. Drupal 8 is awesome]1
I have a form on a node, that displays 2 fields that are entity reference fields from the current node page. It shows the correct info on the label of the fields, but as soon as you save the form, it saves the nodes title and not the correct info.
See screenshot at https://www.dropbox.com/s/rwj1lu1d34zgb53/ScreenshotEntityform.jpg
I don't know PHP or how to mod/write a Drupal module, I just need some guidance as to if this is possible and how to do it, so any help would be really really great, thanks.
There is a setting to edit how an entity reference field is displayed.
If you go to Structure > Content Types > Your Content Type > Manage Display then you will see a select box to control the format of each field.
The entity reference field will let you choose between either label, entity ID or rendered entity. It sounds like at the moment it is set to label so is showing the node title. If you set it to show the rendered entity then it will show all fields that belong to the referenced entity.
The easiest way to hide fields you don't want displayed would be to install the Field Permissions module. This will give you a setting for each field that allows you to choose who can see it. If you don't want to use the Field Permissions module you could create a custom template but it sounds like your trying to avoid that...
Im kinda new to drupal, and its views. SO can anybody tell me how do i make structure like on picture below
http://d.pr/i/LrYX
You will need to enable the Views UI module as well as Views and its dependencies in order to build views.
You will want to create a content type that represents the 'company'. Then you will want to give it an image field for the logo, and maybe a link field or a text field if you want it to link back to something. This is all core in Drupal 7 with the exception of the link field.
When creating the view have it show a grid of fields for the content type you just created. View creation screen should look something like this.
Add the fields using the AJAX interface on the left and set the grid to show 4 columns in the Settings for the grid format. This configuration is in the left column under the format header.
The left handle column should look something like this before you start adding fields.
After that the rest is just CSS.
My setup: I'm using Drupal 7 with lots of contrib modules (Chaos Tools, Views, IMCE, etc.) I'm not sure if Views are considered Entities right off the bat, but I'll be asking this question assuming that they are.
My question: How do I add a field to all Views that asks the admin for an image?
The context: I have a sidebar module that lists every View. I need them all to have thumbnails to the left of them.
What I've tried: I've tried looking all over the Field/CRUD APIs but I could not find anything that appends a field called "Image" to the end of the views_view table. I also tried watching some conferences e.g. DrupalCon but I couldn't find anything that was specific to my question.
Don't know exactly what you mean by "asks the admin for an image", but asuming you'd like to add a static image to a view you have the following options:
( probably easiest) add an image tag to a view block template.
If you don't yet have a block template create one in your theme template folder and name it: block--views--{VIEW_BLOCK_DELTA}.tpl.php, copy the contents of the default block.tpl.php into the file and then add the img tag.
Login as admin, go to: structure > views and then click edit on a view you'd like to add image to.
Go to fields section.
Now it depends if you want to use the image path from cck field value OR you want to hardcode it, like you would in the 1st example.
CCK field way: ( first create a cck field of course), add it to your view fields list, go to rewrite result and tick "Rewrite the output of this field" and then add to textarea sometihing like that:
< img src="[YOUR_FIELD_NAME]">
You can also hardcode it, if you don't need it to be stored in a cck field in db:
select a random field, click on it, go to go to rewrite result and tick "Rewrite the output of this field" and then add to textarea sometihing like that:
< img src="trololo.jpg"> [RANDOM FIELD NAME]
This would just append the image next to an existing filed, so with just a little styling you could achieve your goal quite quickly
I'm using this excellent method to attach an image gallery to a node using 'Views Attach' and 'Node Reference URL' modules (amongst others): http://www.lullabot.com/articles/photo-galleries-views-attach .
It's working fine. What I'm trying to do now is to create a page of teaser items that will have an attached single image version of the gallery.
After creating a new Views attachment for the image I can do this using a new page View that uses Row style = Node, and this works (the image is displayed). However this doesn't give me the fine grain options that using Row style = fields allows.
So is it actually possible to use Row style = fields with Views AND have another View attached to it? I thought there might have been a nice 'Attached view' field to choose... :)
Edit: I guess I can use a themed version of the node teaser to remove some of the node elements I don't want to show up (tags etc.). Will try that...
Cheers,
James
Just build out the views using rows. Then you can override the view template for that particular view (ex: views-view--yourviewname--block-1.tpl.php).
Within that template you can embed any of your other views
ex: <?php print views_embed_view('viewname','block_2')?>
You can do what Hunter Frazier suggests, or you can add his PHP snippet as a PHP field to the view settings. In this way, you don't need to create a template file because the view output is considered a field of the primary view.