Use this tag for questions about the field API, how to use it, or which hooks are required to implement a field in a module; use "tag:fields" for questions about fields implemented in modules you are using.

learn more… | top users | synonyms

0
votes
0answers
7 views

Add field formatter settings to all field formats

I would like to be able to modify the display of any field formatter. To to this I think the best approach is to add settings to all field display formats. Alternatively, I could create my own field ...
0
votes
0answers
16 views

Incorrect array depth when saving custom field

I have a module that implements all necessary hooks for a custom field api. I can see hook_field_validate() and hook_field_is_empty() working properly and values are also available on hook_pre_save() ...
0
votes
0answers
14 views

field_attach_form: multi-image is not working on ajax

I am using custom form and in a fieldset I am assigning field which is from content type I get by using field_attach form. When I attach it directly it is working fine. But when I use it attaching to ...
-1
votes
0answers
14 views

Proper way to delete field on module uninstall

I have a custom module that created some Field API fields for a custom entity in this module (using field_create_field()). When the user wants to uninstall it, I thought it would be appropriate to ...
1
vote
0answers
13 views

How to use a field as an entity's property

My module provides its own entity. I need my entity to have a link field with multiple values. The module link is suitable for this. At install hook, I create a field and a field instance of link ...
2
votes
0answers
16 views

Dealing with #disabled and #access in hook_field_validate

is there any way to disable hook_field_validate when the corresponding field widget is disabled (via #disabled = true or #access = false) in corresponding form? Or, alternatively, is there at least ...
1
vote
1answer
25 views

Unable to retrieve user id of edited user from $entity in hook_field_validate

I have this little problem with a custom field that is bundled with user. In its validation function I need to have access to the user id of the user whose field is being edited. What that means is, ...
0
votes
1answer
16 views

How to convert a unix timestamp field in views

I'm keeping a Unix timestamp in a text field. In Views, I want to convert it to a readable date. This is a commerce view, and the field is a custom field of an order. Can I use ...
0
votes
1answer
20 views

Is there any API to get corresponding field in a custom content type?

I have drupal 7 and created a custom "content type" with several fields. just imagine i have: title field subtitle field I need to search the data. I want to search titles and when i found my ...
0
votes
1answer
67 views

How should i get corresponding field value for taxonomy filed attached?

I use drupal 7. I created a content type with these fields: one field to upload a file to private folder a taxonomy field (for that file) my problem: i can save one file with one taxonomy! but ...
0
votes
0answers
6 views

Add new field/field instances to my custom entity when installing module? [duplicate]

I have created a module that creates/declare a new entity type/bundle. I want to create a new field(Field API) and field instance to attach to the bundle but I don't know where to put my code? I ...
0
votes
0answers
17 views

How To get custom entity field show up in rules actions - drupal 7

I am using drupal 7. I have a textfield from a custom module (birthday module) on a user account entity which i named "field_birthday" but when i try to create a rule that will apply on the field, it ...
0
votes
1answer
63 views

How to display all values of List (text) instead of just the selected ones?

When viewing a node, how can I display all values of a List (text) instead of just the selected ones. So, instead of displaying: B (good) I want to display all values, with some markup telling ...
0
votes
0answers
17 views

Dynamic list of select field

I have created list field for content type. My allowed values list is huge and dynamic. Is there any way i can use this field and dynamically create allowed values list, without saving all options in ...
0
votes
0answers
14 views

How to change the order of the fields returns by field_info_instances() function?

I am using field_info_instances() function to get all the fields of a content type and display it in a csv file. but the problem is I can't change the order of the fields return by this function. ...
0
votes
2answers
104 views

Adding attributes to field_view_value

I'm using the following function to render a image field in a template, this works great but I would also like to add a custom alt attribute to the image: function <module>_render_field($node, ...
0
votes
1answer
22 views

Simple way to pull taxonomies

I am building a module to that uses taxonomy, I would like to use drupal functions as much as possible vs going to the database directly. In addition I am using the Field Module to add additional ...
0
votes
1answer
15 views

How to store a list of bundles in a select field (programmatically)?

I need to be able to present a list of available bundles (in this case, Commerce Line Item types) as a select field on an entity, so I can use the value in a custom module. Suggestions? I've tried ...
1
vote
1answer
111 views

How to programmatically set a node field as empty?

I have some nodes of a content type with following fields: title body image I want to programmatically (!important) set the body field as empty (to make it like it was never set with any value). ...
1
vote
0answers
31 views

field_view_value returns null for boolean field

I have a custom field field_sold which contains a single boolean value. I'm trying to use the following function to retrieve the content of the field, but it always seems to return null: function ...
2
votes
1answer
55 views

Can't disable module when it defines an field type used by a custom entity

I have created a module that creates a custom entity (using hook_entity_info etc.), defines a field type (using hook_field_schema and hook_field_info), and then creates an instance of the field type ...
0
votes
1answer
17 views

hook_field_schema not being used

I'm trying to create a field with an additional property (or column) to define an extra relationship to a taxonomy term. I have this in my module file: /** * Implements hook_field_info(). */ ...
1
vote
3answers
151 views

How to add an image field to a programmatically created form?

Basically I want to create a block with my module which's edit page has a few content fields and two image upload fields. When visiting the node where this block is rendered, I want to render the ...
0
votes
1answer
43 views

field_info_instances returns array is not in order

I'm using field_info_instances function to retrieve all fields info under a content type. (ex: field_info_instances('node','bundle_name') ). But the return array fields are not ordered as I expected. ...
0
votes
2answers
115 views

Drupal function field_get_items vs user_load

In Drupal, I want to read a custom field value for a group of users while logged into an admin account. I only need 1 field value from each user, the same field and I do not need this information ...
1
vote
1answer
14 views

How to detect if field support multi values?

It seems that field_info_instance doesn't return such info...
0
votes
0answers
87 views

Writing custom PHP code in Rules to check if a file field has a new value

I need to create a condition in Rules that evaluates whether a new file has been uploaded to afile field. The file field has an unlimited value setting and I need to send out notifications to users ...
0
votes
3answers
37 views

update node field without node be updated

I want to update a field of node programmically,I did it with below code $node = node_load($nid); $node->field_share_counter['und'][0]['value'] = ...
0
votes
2answers
22 views

How to add more data to a field

I'm trying to find the best way to extend a field's data set (not even sure of the right terminology). What I want, is to attach some other information to an existing field. Let's take a file field, ...
0
votes
1answer
32 views

Get the default image for a profile2 image field with code

I need to get the fid of the image specified as the default for an image field in a profile2 profile. There is a field_get_default_value function, but it is not clear to me how to use it. I'm using ...
0
votes
1answer
21 views

Retriving field value

I have field called field_3d_model_xml_path which is a text type. I am currently retriving the value like this. //get current node $node = menu_get_object(); //build xml path $xmlPath = DRUPAL_ROOT . ...
1
vote
1answer
42 views

Unsetting a field before hook_form_alter

I have a field collection with two entity reference fields that I keep hidden on a node creation form. The reference fields in the hidden field collection are slowing down the page load time. I need ...
0
votes
1answer
47 views

add new format to description fiield of taxonomy display modes

when you go to structure -> taxonomy -> VOCABULARY_NAME -> manage display you will find the description field with no label, and with two available format : hidden and visible. I want to ...
-1
votes
1answer
130 views

Add a remove button to a custom unlimited value field?

I'm working on a custom compound field that includes a text value and an entity reference id. The field will contain multiple values, so the widget needs to provide "add new value" functionality, and ...
0
votes
2answers
36 views

Accessing field inside a block

I have created a block to display flash content. All it needs a a variable to be assigned dynamically from the content to flashVar. I created a field called myfile path in the custom content type. ...
0
votes
1answer
41 views

Store array of ids in a field programmatically?

Devel noob here. I am writing a module where I need to stash a list of entity ids in a field on a different entity. I've created a field on an entity type programmatically and have it set as field ...
3
votes
1answer
137 views

Printing field item attributes with Twig / Drupal 8

In Drupal 7, I can do this in a custom field template to print the alt tag of an image: <?php print $item['#item']['alt']; ?> And though "item" seems to be a variable in Twig / drupal 8 ...
1
vote
2answers
49 views

How to hide a field (cck) based on a date field?

I am looking for a way to hide a content field based on the nodes date field. Example: Event Name: Some Name Here Event Date: 12/12/2012 Event Location: Somewhere Buy Tickets: ticket.com If the ...
0
votes
0answers
56 views

How to display sub field values in EFQ Views Backend?

Context : Drupal 7 Custom Entities using Entity API Custom Fields using FieldAPI Mongo Storage engine for all fields, incl. custom fields EFQ Views Backend I have a D7 site with custom entities, ...
0
votes
1answer
21 views

all modules that use the field api module

Sorry if this is a basic question, is there a way to browse all modules created with the fields api. I am looking for some interesting ways to format and use fields.
0
votes
2answers
67 views

create a custom field schema

When I create a new field programmatically, drupal create a default schema for my being added and for each new field added is create a new database schema. I noticed that the columns always have the ...
0
votes
1answer
37 views

Basic Page - Associated Image Field

I created an Image Field for the Basic Page Content Type. I want to control the output of this image to use as a banner with a caption on top. Is there a function to render out a field specific to ...
0
votes
1answer
27 views

How to prevent data loss from custom field when using Views Bulk Operations?

I have developed a custom field type, widget etc all in its own module. We also use Administration Views module with Views Bulk Operations. Our content guys used the VBO action Publish from the ...
1
vote
2answers
56 views

user only can select image from media in media module [closed]

I want to have a field in custom content type that let user select its value from images that showing in popup , , anybody know which module can do it for me if there is not module ,how can I ...
0
votes
1answer
73 views

Pulling Possible Select Values From A Field (Drupal 7)

I have been looking if there is a function that return all the possible values for a field. I have a select field that is a Node Ref. So, function list_allowed_values() is out of the question. ...
1
vote
1answer
64 views

Issue with custom widget

I have a custom auto-complete widget that I use to create a custom field that is used to create a custom content type in a custom module. I have hook_field_widget_info function ...
0
votes
2answers
42 views

I can create content type fields pragmatically, but I set het widget options too?

Im using field_create_instance to create all my defined fields, and use the correct field types and widget types and such, but Im not sure how to set the widget options. In my use case, Im using the ...
0
votes
3answers
99 views

node_data_field not working on 6

I have this structure: <div class="FloatLeft RightText">: '.$data->node_data_field_story_text_html_field_kampanya_adi_value.'</div> <div class="clear"></div> ...
0
votes
1answer
25 views

Views isn't pulling custom field correctly

I've been developing a custom module, which uses the node id, with the rate module, to output the results to a simple mathematical equation (which uses the rate module - i.e. voting api) to calculate ...
0
votes
1answer
41 views

Add field_tags on module install [duplicate]

Is it possible to add the field field_tags in mymodule_install() like the body field? I added a body field with node_add_body_field. I can see the field in field_config_instance table. Is there a ...