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
11 views

Ways of setting new value to a custom field in template.php file

I'm trying to set a field's value of a node in template.php file of a theme if the field value is empty but the problem is that when the field value is empty, I cannot make any field function work in ...
0
votes
0answers
6 views

Multiple select do not save for my custom field with custom widget

I'm trying to save multiple values from multi select option form which I created in the custom widget with: $element['labs'] = array( '#type' => 'select', '#options' => $list, '#multiple' ...
0
votes
0answers
4 views

What is the correct way to create a new profile2 entity and provide fields for that entity programmatically?

Using my module, I want to create a new profile2 profile. The hook obviously is hook_default_profile2_type. I created that profile in my custom module's .module file and it works as expected: ...
0
votes
1answer
19 views

Rendering Content Multiple Times in a Node

I'm starting to dig deeper into themeing and I'm thinking maybe I'm misunderstanding something. Basically I want to break apart the way the content is laid out in my node--example.tlp.php file. I've ...
0
votes
1answer
21 views

Programmatically created list_boolean checkbox field value won't get saved

I've added a lot of fields and field instances via a custom module to some prepared content types. field_create_field() and field_create_instance works like a charm, not a single error. Every field ...
1
vote
1answer
14 views

Achieve single node field edit to have different values for each user?

I am trying to create lets say and activity node which allow each user to insert a different value without having to create a node. for example: I created activity1 node, and then I will allow user a ...
0
votes
1answer
44 views

How to change the display of my field?

I have a field in one of my content types called lab_test_id. When Editors add content of that type they enter all the ids of the lab tests associated with that node. I need to be able to take that ...
0
votes
2answers
12 views

Add html5 placeholders to node_add inputs

I'd like to add placeholders to node_add field inputs. I'm trying to use dpm($form) but am not sure where to put it. I couldn't get node-add.tpl to work with this function MYTHEME_theme() { ...
1
vote
1answer
36 views

Taxonomy tags are not saved - Field API - Drupal 7

I am creating a new content type and I want to add a Tags field. I created a vocabulary and a taxonomy_term_reference, field but this field is giving this notice every time I try to add content and ...
0
votes
1answer
15 views

Getting the field of a user based on uid or name

I'm trying to display some custom user fields of an author, of a content type's nodes. The only fields in $node that relate to the author seem to be $node->name and $node->uid. I tried this in ...
0
votes
0answers
10 views

Undefined index: comment_node_quiz in Field List report after uninstalling Quiz module

After uninstalling Quiz module, my Field List report displays about 40 red notices about undefined index. They look similar to this: Notice: Undefined index: comment_node_quiz in ...
0
votes
1answer
36 views

how to modify field of a node?

I have a custom text field which I use to display some voucher code to users. I have it in a custom content type named (machine name) : 'add_deal'. What I want to do is to style the field when the ...
1
vote
1answer
38 views

Controlling node's content using field setting

In a module I am developing I wish to control display of a link in node's content depending on user's choice. I want to display this option to user(whether he wants to display the link on particular ...
0
votes
0answers
17 views

How do I substitute a field file input type in node create/edit?

I have a field image called "getFromFlickr". Via hook_field_widget_info(), I create a piece of form that (when in edit/create node), build a modal, call flickR, get one image, save the file in the ...
0
votes
0answers
17 views

Programmatically set a multi value date field

$checked = array(); foreach($form['field_rundays'][LANGUAGE_NONE]['#default_value'] as $key => $val) { $checked[$key] = $val; } r($i=0;$i<count($checked);$i++){ $date = ...
1
vote
0answers
36 views

How to remove a configuration object from active config in Drupal 8

I'm writing a custom module for Drupal 8. It defines a field storage config object, in a file called modules/mymod/config/install/field.storage.bloom_stem.bs_twitter_ac.yml. The problem is that this ...
0
votes
1answer
23 views

Drupal node_load display all fields

I have a template for a view in which I load a node. Is there a way to get the value of all fields from that node? Like, if I add another field in CCK it will appear automatically in the template. ...
3
votes
2answers
49 views

How do I store large volumes or data points using Drupal ( temperature and humidity points )

I'm trying to use Drupal as a headless API, and so far I'm having good results. One of the things I'm collecting is a Temperature and Humidity data. Thus far I've created an entity that can hold the ...
0
votes
0answers
106 views

Add a taxonomy type to a custom field using Field API

I maid an edit to make problem more clear. I'm creating a new field type using Field API (using hook_field_info , hook_field_schema ,hook_field_widget_info , ...) my custom field should store ...
0
votes
0answers
25 views

Use translated node title in views

I use the Title module together with internationalization in my Drupal setup. Everything works fine. I can translate the node titles and their translations are displayed fine on the node page when I ...
1
vote
2answers
21 views

Editting field collections with service api

I am trying to build an phonegap app which uses data of a drupal site. I need to update some informations with using app. For example I have nodes and users need to update field_collections of a node. ...
0
votes
2answers
43 views

How to add custom settings / attributes to a field

I want to be able to add custom settings / attirbutes to field instances. I can create a custom field with custom settings no probs, but is it possible to get rid of the custom field and just add the ...
1
vote
1answer
41 views

Using field api to get key of select list option

I need the safe output of a key from a select list field within a field collection item. I'm theming a field collection item and one of the fields is a select list like: icon-map|Map icon-info|Info ...
0
votes
1answer
50 views

Custom field widget form - Multiple values

I've create a custom field form widget for an entity reference field. When only one value is allowed it shows a (filtered) select list, but I want to allow user to assign multiple reference values to ...
0
votes
1answer
29 views

How can I escape the brackets so they are seen as literal characters

I am using clientside validation along with the field UI module in a Drupal 7 site to request some custom input fields on user registration. I need to set some custom error messages using the ...
0
votes
1answer
20 views

How to display translated options for list(text) fields with field_view_field()?

I have set up a list(text) field with translated content. In display admin interface (admin/structure/types/manage/***/display), I have set up it to "Default translated" in "format" column. Then if ...
0
votes
0answers
6 views

When is data field 'save_value' set and when not?

I am printing a node using the following code: $node = node_load(arg(1)); $output = field_view_field('node', $node, 'body'); dpm($output); And I saw that sometimes the data field ...
2
votes
1answer
95 views

Move required span of fields outside the label

Normally in Drupal if a field is required, the Asterisk sign would render inside the <label> tag in a <span>. for some reasons I'd like to move the span outside the <label> and ...
0
votes
0answers
26 views

Fatal Error while sending a multipart POST request to a image upload created using Field API

While testing a site i created using "Acunetix" web vulnerability scanner, it posted a multipart request to a image upload field created using Field API. The test manipulated a POST statement and ...
2
votes
1answer
144 views

Use a Custom Field in page.tpl.php

I have a custom field called site_category that I am using in a few different content types. The field site_category is an entity reference to a content type which has only one field defined: Title. ...
1
vote
4answers
199 views

Create a checkboxes-field with a radiobutton for all items

Usercase: Have a list with services for shops. Those services can be done with an appointment, or without. So the services are checkboxes, and the radio needs to show if it can be done with or without ...
1
vote
1answer
33 views

Add custom HTML to custom field

In a module, I have defined a custom field. Using hook_field_formatter_info() and hook_field_formatter_view(), I can manage the display of every item (value) within that field. I want to allow the use ...
0
votes
0answers
14 views

How do you populate a multi-value field with a specific number of empty fields?

How would you go about generating a specific number of empty fields inside of a multi-value field on page load? In my case this multi-value field is a simple text field, and I'll be passing a URL ...
0
votes
0answers
30 views

Switch Database in Entity Reference

The Drupal site is connected with two databases like this: $databases = array ( 'default' => array ( 'default' => array ( 'database' => 'default', 'username' => ...
0
votes
2answers
18 views

Flip Boolean Value in Field

I have a product with a field that's a boolean value "Contains Gluten" which stores a "1" for yes and a "0" for no, this is stored in the database as field_contains_gluten_value. The client now wants ...
0
votes
1answer
15 views

How can I make web scraping of a field more difficult?

I have a text field that I get with <?php print render ($content['field'][0]['#markup']); ?> in node.tpl. I'd like to somehow make loading the markup require a click, and deselecting it to put ...
0
votes
1answer
39 views

Access values from multiple field forms as elements of one form

I'm trying to create entities from my custom form. To do that, I created "Add more" button, where I'm dynamically adding new elements that I'm attaching fields to by using: ...
0
votes
1answer
30 views

On node edit form, how to edit field from a referenced entity?

I've got a master entity (node) that users edit, and I've got an entity reference on it. I'd like to be able to edit a field on the referenced entity on that master referencing entity's edit form. Is ...
0
votes
0answers
21 views

How to prevent user from deleting field but not from modifying it?

Just like in the question. I'm creating a module, and using field as it's essential property, I would like to allow people to change it, but make it unable to delete it by using Field API. Any ideas ...
0
votes
1answer
14 views

Drupal Field API - Settings List

I'm trying to create a 'link_field' in Drupal through a module, I've got the following code but I'd like to configure the field settings to do the following: Not require title Update the number of ...
0
votes
0answers
38 views

How to add text with summary field in drupal?

I am using drupal form API to create my form and want to create a text with summary field but when I use the type text_with_summary, nothing shows up in the form. For now, I have used two separate ...
0
votes
0answers
39 views

What is the use of module_invoke_all?

The documentation states the following. Invokes a hook in all enabled modules that implement it. All arguments are passed by value. Use drupal_alter() if you need to pass arguments by reference. ...
0
votes
3answers
62 views

Add foreign key to schema using hook_update_N

I've written a module that establishes a child/parent relation ship between magazine issues and the articles in each issue. The idea is that by associating articles with magazine issues they can all ...
1
vote
0answers
25 views

Massive conditionals in field_sql_storage_field_storage_load query

In Drupal 7, I've been struggling with a slow local (and remote dev) site for the past few days. If I try to edit a field on a Message entity type, it hits my 720 sec execution time limit (normally ...
1
vote
1answer
42 views

Wrong caching of embedded views block

I am having trouble with the Cache API in Drupal 8. I embedded a views block with pagination through a field preprocess function into a node. When caching is off, I can normally use the pager and will ...
1
vote
0answers
19 views

How to create a new widget for a plain text field

I have a text field on a content type in the admin. This week I only like people to fill in, say, the words 'yes','no' or 'i forgot'. I dont want to create a new fieldtype. Next week, I will implement ...
1
vote
1answer
31 views

how to make an existing listbox autocomplete

I have made a content type which has a list box field. now I need to change its widget to autocomplete but as you know list box fields does not have autocomplete widget. now I have added 650 contents ...
1
vote
1answer
18 views

translate a field before rendering

I made a content type programmatically with the entity_translation module. There are about 250 fields. 240 fields are not to translate because their values are identical. So I only want to use ...
0
votes
1answer
45 views

Field Template Suggestions: Target a particular field type on a content type

I want to use a field template for all the fields on my "journal_page" content type that use a widget of "long text". How would I do this? N.B. My field is not named "long text". "Long text" is ...
0
votes
1answer
25 views

Custom field “required” validation

I built a custom field type using the Field API. In hook_field_validate I have some logic to validate some very custom stuff, but when I tried to add a "This field is required" validation, I realized ...