All Questions
2,664 questions
2
votes
3
answers
1k
views
Conditional display of CCK fields
I was wondering if there is any other way apart from coding (and, possibly, using the rules module) to make the showing of a field dependent on the existance of another field.
Say you have in a node, ...
1
vote
5
answers
10k
views
Get Fields of a custom Content Type from Database in Drupal 7
I'm trying to get custom fields of my custom content-type "slideshow". I've chosen to get the fields from template (.tpl.php) file for some reasons (mainly because I've to write lots of formatting ...
1
vote
2
answers
8k
views
Getting fields of a content type in template file - creating a slideshow
I need to add a slideshow (each slide containing headline, image & html text) in my frontpage. I've decided to create a custom content type named slideshow which should have above fields.
I've ...
4
votes
2
answers
9k
views
How do you get the nid from an entity id?
I've got a field collection attached to a node. Given the entity ID of a given instance of that collection, how do I obtain the nid to which it's associated?
When using entity_load, the nid for some ...
7
votes
1
answer
796
views
Using Fields as Attributes in Node Templates
What is the best practice for using a field as an "attribute" in a node template with Drupal 7? I am using the term "attribute" loosely here to mean something that can't be concretely rendered as an ...
9
votes
3
answers
3k
views
Conditionally display one of two fields in Display Suite?
I'm wondering if there is a clever or preferred way of using Display Suite to display one of two fields.
So my case calls for either an image, if it is uploaded, or a EVA (entity views attachment). I ...
1
vote
1
answer
75
views
Email field does not show up when I view node, only when I edit
I have an email field in an entity. The text field is there when I edit the entity but it does not display when I view the entity. How do I get it to display when viewing?
0
votes
1
answer
1k
views
Displaying field twice in same node
I want to have two styles of a specific field. How can I display the field twice so I can style each one differently?
1
vote
1
answer
3k
views
Display content type in custom display format
I created an content type of name "profile", where it has fields
Profile Name, Image , message , body.
It displays in this format attached image_1
Now how can we arrange or make change in custom ...
2
votes
2
answers
1k
views
How do I lock a field on Node Edit?
I want to create a node field that is only editable upon node creation. Once the node has been created, the field of that node will no longer be editable.
5
votes
4
answers
7k
views
How do I create a Machine Name type of field?
I need to add a Machine Name type of field to Nodes of a certain Content Type. It's the same Machine Name field that Drupal is using when creating Content Types.
Example: If I enter "My Title" in ...
2
votes
1
answer
5k
views
How can I hide a field with Views if another field has a certain value?
In my Drupal 7.8 website (with the Views and Panels modules installed), I'm trying to display a view pane in a panel. However, I only want to show certain fields in that pane if another field has a ...
5
votes
2
answers
431
views
How can I allow users to add a reason for a flag?
I have the Flag module installed on my Drupal 7.8 site, but I can't figure out how to allow users to submit a reason for a flag along with the flag. I've tried looking this up, but the only thing I ...
1
vote
1
answer
1k
views
field_widget_form call as a custom form
I want to call my custom field_widget_form with the use of drupal_get_form()
Is it possible to do that?
simple requirement .. I want to build a form where user enter the field value and that value ...
1
vote
1
answer
1k
views
Display multi values field as html list
In my content type I have two multi values fields for images and embedded videos. Those fields are displayed in view.
I wanted to display elements of these fields in carousel. I found solution on ...
1
vote
3
answers
1k
views
How do I prepopulate a field with calculated options, when user is editing node?
Say the user is creating a node. I want to display a drop down option list, with prepopulated options, based on a calculation (i.e. reference to user's groups, user's other nodes, etc...). Drupal 7.
...
4
votes
3
answers
5k
views
How do I get rid of the node title on a specific view mode?
I'm using Drupal 7 with Omega subtheme and Display Suite module.
I have a content type and the nodes are displayed as default (Full Content). But I have two or three nodes of this content type which ...
1
vote
1
answer
1k
views
Where is the entity ID stored?
I have an installation which I am trying to upgrade from Drupal 6 without much success. I have decided to manually port the database over.
I realized that in a fresh installation of Drupal 7, node ...
1
vote
1
answer
527
views
how do i store fields in one table via the install file?
I am new to d7 and I am writing an install script. This install script needs to create a content type (I've done that) and then create lots of fields that are used in this.
The problem I have found ...
19
votes
3
answers
16k
views
How to change a field value with a Rules Action?
I'm trying to set up a Rules Action that can change the value of a field. I created an Action Set with a data type of Node. When I go to create a Rules Action, I have access to every default Drupal ...
1
vote
1
answer
202
views
What urls does a page manager intercept?
The custom page is set up to intercept /sections/%section. Will it intercept an URl such as '/section/section-1/articlename' or only '/section/section-1'
Regarding answer from Berdir:
How do I get a ...
18
votes
4
answers
10k
views
EntityFieldQuery vs Db_select()
Why should I use EntityFieldQuery when I can do the same work with Db_select() to fetch the value.
It would be better if someone can provide an example, not only a link.
2
votes
1
answer
3k
views
How do I tweak an image field markup?
I have an image field that is set to link to content. Drupal makes this markup:
<a href="/content-page">
<img src="http://mysite/sites/default/files/image.jpg">
</a>
Now I need ...
23
votes
5
answers
43k
views
How to update a field value for a node?
I want to change the value of a field for a node.I used the following code:
$node = node_load($nid); // $nid is the function's parameter
$node->field['field_myfield'][$node->language][0]['value'] = 1;...
0
votes
1
answer
85
views
How can I customize the way my taxonomy terms are displaying?
I have been searching all over the place for some help on this.
I currently have my tags displaying for each node like such: tag,tag,tag
Now I would like them to display a little cleaner and more ...
2
votes
2
answers
122
views
Module for extracting information from remote site?
I want to give user better experience when filling in forms. They are prompted to fill information about some product, like price, description, image, etc...
My idea is that I'll let them just copy &...
4
votes
2
answers
1k
views
How to trigger JavaScript/jQuery on AJAX-enabled ImageField submit?
I'm trying to trigger a JavaScript event when an AJAX-enabled ImageField submit button is clicked.
I've tried variations on delegate(), submit(), and click(), but no joy.
This is something similar ...
0
votes
1
answer
4k
views
How to add field classes from within template_preprocess_node
During template_preprocess_node I would like to be able to dynamically add classes to specific field wrappers.
Is this possible or does template_preprocess_node run after template_preprocess_field? I ...
4
votes
1
answer
3k
views
Update node multi value field programatically
I am trying to update a node with a standard multi value text field programatically with the following:
$node = customfunctionreturnsnode();
$node->field_scores['und'][$dayof]['value'] = $total;
...
4
votes
1
answer
1k
views
field_info_instances() returns an empty set in hook_uninstall but not in module file
Why would field_info_instances() return an empty set in hook_uninstall() when it returns the expected results in the main module file?
I've used the exact same code to delete the fields for a set of ...
0
votes
2
answers
119
views
send fields in a email
I'm fairly new to D7 and I don't know where to start. I have a "Event" CT(ContentType) with many fields in it. Dates, prices, text, html description.
I need to put some fields in a plaintext email ...
7
votes
1
answer
974
views
When hook_field_load and hook_field_formatter_view are called?
I have implemented the hook_field_load() and hook_field_formatter_view() function to replace some characters in a specific field's value. But they don't seem to be called at all.
I wrote some command ...
0
votes
2
answers
1k
views
How do I access node body from template.php?
Here is my code so far:
if (!empty($page['content']['system_main']['nodes']) && is_array($page['content']['system_main']['nodes'])) {
foreach ($page['content']['system_main']['nodes'] as $...
1
vote
2
answers
3k
views
How to extend default user registration page in Drupal 7?
I would like to extend the default user registration page by adding more fields that will be stored in the same users table of database with the default fields.
What is the easiest way to do that? ...
0
votes
1
answer
58
views
What's the best way to add an entity (of a specific type) selector to a form?
I can achieve what I want by using the EntityFieldQuery and transforming it to be the right format for a radio options array.
Is there a better way?
2
votes
0
answers
772
views
Programmatically delete term from taxonomy term from all referring term reference fields
I would like to be able to programmatically delete a taxonomy term from all instances of term reference field that targets that terms vocabulary.
My reason for this is that I believe I've encountered ...
17
votes
5
answers
41k
views
Check if a field is empty
How to you check that a field is empty, when you have the $node object?.
I found this as possible solution:
$field = field_get_items('node', $node, 'field_post_image');
I can check now:
UPDATE.Ups!...
2
votes
1
answer
2k
views
How can I use Entity API to integrate my entities with views?
I've set my entity up with a custom controller but I want views integration. I tried to follow the entity_test.module example, but it's for one bundle. I want to create 4 bundles for my entity. ...
1
vote
1
answer
469
views
Does Organic Groups Views allows post to group relationships?
Does anyone know how to create relationships between Post entity and Group entity. I have a view that lists group posts and I want to add group title on the same row. This issue (http://drupal.org/...
36
votes
12
answers
39k
views
Get all users with specific roles using EntityFieldQuery
I thought this was an easy task, yet there does not seem to be a Drupal-method for this. I came as far as knowing I have to use EntityFieldQuery for this - because the API said conditions for ...
4
votes
1
answer
2k
views
How can I make my entity controller class fetch the fields that have been programmatically attached?
I've created a field, an instance of it, and attached it to a bundle that I've defined in hook_entity_info().
When I call up a new entity using entity_get_controller('module_content')->create($...
78
votes
4
answers
74k
views
How do I load a field collection from a node?
I have a node that has a few field collections on it.
When I look at node_load() output, I see:
[field_rich_text_group] => Array
(
[und] => Array
(
...
1
vote
1
answer
153
views
Specification of an Image field attached to forum topic node type?
I have somehow a strange issue with Fields : I've created an Image field for each of my content types. This image field allow the insertion of images into the node body with Insert and Colorbox. ...
0
votes
2
answers
2k
views
Drupal 7 node reference field formatter for nid
I'm working in Drupal 7 and using the reference module to attach an node reference to another node. I'm then using views to show some of that nodes fields. When I display the field for the node ...
3
votes
5
answers
6k
views
How to enable WYSIWYG in a text field summary?
I have a body field (Text field with summary) with WYSIWYG CKeditor enabled.
However, the "summary" part of the field lacks a WYSIWYG editor.
How can I enable it?
0
votes
1
answer
1k
views
Rewrite taxonomy_term_reference urls to read /taxonomy/term/(name)
After creating a view to allow /taxonomy/term/(name) to show content tagged with that term, I am trying to find where I can override the generation of field links (field_type_taxonomy_term_reference) ...
2
votes
1
answer
162
views
How to display nodes in a view, each row using a preselected view mode ?
I would like to create a view that displays a number of nodes, each using its own chosen view mode.
I've installed the Display Suite module and created a number of view modes. Using the Views module, ...
2
votes
2
answers
4k
views
How to programatically create an address field
I would like to use the address field module in my module. How do I create an address field and an instance for that field. I haven't found any code in the module that defines what the array ...
5
votes
1
answer
2k
views
Sort an entity query by a term reference field's term weight?
I've created an entity query to get an array of nodes based on a specific content type,see below:
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
$query-&...
0
votes
1
answer
548
views
Can the same entity type (bundle) have different fields in different instances?
I have a question about adding fields to an entity I've defined in a drupal 7 module upgrading from d6 which has 4 types. The modules get a list of fields from a 3rd party server and if the user ...