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.
0
votes
1answer
26 views
How can I override the autocomplete.js file while developing a module?
I want to override the default tags field wherever it is used. After looking through a few files, I figured that I should override drupal/misc/autocomplete.js and the Drupal.jsAC object.
Is it ...
2
votes
1answer
30 views
Rewrite View field value
I have a Views table that simply shows a list of Entities.
Now at the moment, field 'status' just outputs the raw data 0 or 1.
I want this to be rewritten as 'Pending' or 'Approved' respectively.
...
1
vote
1answer
17 views
How do I structure node data that records time and quantity?
I have a node that will have one field that will be updated often by adding a field with a time and quantity of an item. I would like to output the data as a table.
Some fields the node will have ...
1
vote
1answer
33 views
Drupal 7 Customize Node Add Form
First, let's describe what I have already:
Vocabulary: "Categories" with some terms added(cat1, cat2, cat3)
New content type "custom_page" where I added a new field of type "Term reference" using ...
0
votes
1answer
21 views
How do you display fields created via the File Entity settings configuration?
I have a question about adding fields to the file type field. Someone suggested usingthe file_entity module, and I tried it out and it lets me modify it's configuration settings, adding a few fields, ...
1
vote
0answers
13 views
Port back to d6 $instance
I have this code that I am trying to get back to d6
$field_name = variable_get('blogger_importer_node_tag_field', '');
$instance = ...
0
votes
1answer
25 views
Module: Extend “Authoring information”-tab and adding new field to it
I'm looking for a way to attach a custom field of my module to "Authoring information"-tab.
Thanks for any hint
0
votes
0answers
14 views
Modules/Methods for Faster Data Entry
I have an unlimited-cardinality text field on a node that users need to enter 50-100 values on. Right now, the user has to type in one value, click "add another item", and then click inside the text ...
1
vote
1answer
47 views
Saving custom field value leads to mysql error
I created a custom field as in field_example described, using text_format as type and it shows up a multi line editor without any problems.
But I'm facing a mysql error when trying to save a node:
...
0
votes
0answers
36 views
Keep empty values
I have the following case: I have a field (Long text) with unlimited values. Now I have the following values:
Value 1
- empty value -
Value 3
By default, the second value would get removed. How can ...
1
vote
1answer
75 views
How do I prepopulate the value of a taxonomy term reference field on the node creation form?
I'm using an approach similar to the one taken in this question. The difference is that I have a taxonomy term reference field in the user profile that I want to use to prepopulate a custom content ...
0
votes
2answers
31 views
field_get_items / value when creating new content
I think I am about to lose my mind .. how in earths name do I get the value of a field in a widget during creation? I created a custom field widget, and during creation of new content I want to be ...
0
votes
1answer
24 views
field_widget_form get value
I am creating a custom field and I am looking to get the value of a textfield during node creation. In the callback I need to get the value of the textfield, how do I do this?
function ...
0
votes
1answer
36 views
Check for field values to be unique when storing into the DB
I have a content type "Research assignment" which has several fields including the field "field_user" and "field_project".
I want to remove any old research assignments having the same user and ...
0
votes
0answers
10 views
Single input area widget
In D7, is it possible to create a custom field widget in the way Roles UI (admin/people/permissions/roles) does it, i.e with just a single input area at the very bottom, instead of n input sets for ...
0
votes
0answers
25 views
field label class
How do I add a class to the label of every field of a specific content type.
Module?
Theme?
Is this possible?
I'm using the bootstrap theme, if that makes any difference I can see that this theme ...
0
votes
0answers
8 views
How to debug hook_field_formatter_settings_summary()
In my code I have add:
function mymodule_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
...
0
votes
1answer
38 views
How to programmatically add / remove a value for an unlimited multivalue field?
I was looking at http://php.net/manual/en/function.array-push.php but it seems one cannot use it as multi value fields are associate arrays. Any built in functions perhaps?
Here is an example array
...
0
votes
1answer
58 views
Toggle text field depending on checkbox value in drupal 6
I need to toggle a textbox depending upon the checkbox value.
Basically i need to take email entries for updates.
Here is the form elements I used.
$form['chkupdates'] = array(
'#type' ...
2
votes
1answer
35 views
Altering select elements to include data-img-src
I am trying to create a content type with select list options that are replaced by images that you can pick.
Plugin here http://rvera.github.io/image-picker/
How would I go about altering the option ...
0
votes
2answers
76 views
integer field select list with min and max value
I would like to have integer field that ranges from 0 to lets say 100000 with "select list" widget. It doesn't have to have keys i just don't want to type 10000 numbers in field settings of "List ...
2
votes
1answer
106 views
How to implement a mysql date or datetime field correctly in hook_schema()?
I have written a mymodule.install file which contains a schema definition to create a table in my database. This table contains two data fields. Theese fields will be populated by the users when they ...
1
vote
0answers
52 views
Custom field not showing on edit form
I'm fairly new to drupal development and still trying to wrap my brain around the API. I run an athletic based website and need to be able to store race times using a mm:ss.00 format. I haven't seen ...
0
votes
2answers
81 views
Text input onchange event
I'm working on a custom field that will store a string. The text will have a custom formatter applied to it that will manipulate the structure of the string (adding dashes in the right places). I ...
0
votes
1answer
42 views
Why do certain fields not behave like fields?
Why do certain fields not behave like fields? For example 'Product title' and 'Product price' fields from Drupal Commerce:
You can tell that these two fields are composed very differently. I have ...
1
vote
2answers
54 views
How to get a field value of multiple nodes?
I have some node ids from entityfieldquery. I would like to get the values of a field from all of these nodes. Should I use db_query, or should do a node_load_multiple, and get the field value with a ...
0
votes
4answers
249 views
Extracting a specific data part of a Field Collection Item
I've been playing around with this for the better part of a few days now with no luck. Here is my Collection data:
Collection name: field_video_collection
Within the collection there is a field ...
0
votes
0answers
25 views
In a widget settings form, how do I detect that the user has clicked my custom submit button on form build?
I'm adding some settings to a content type widget settings form that I want to be in a collapsed fieldset. These settings include a custom form submit button which lets the user upload a file or ...
1
vote
0answers
41 views
DisplaySuite, but for fields?
Ok, DisplaySuite is nice, Views is nice. But, I often find myself doing PHP coding using EFQ to achieve the result I need.
Thing is, dealing with render arrays and field API is a massive pain, ...
1
vote
1answer
25 views
Change values of user input in hook_field_validate?
I have setup a custom field and have a validater setup for it. I would like to be able to adjust and actually change the user input from within my validator. so say this is a multi value field, each ...
0
votes
0answers
13 views
How can override or customize the field_add_more_submit to add a 10 or 100 items with a single click
For a field set to multiple values, I am looking for a way to let the user add a x number of items in a single click like :
Add [100] items [add button]
and replace the [Add another item] button.
...
0
votes
0answers
62 views
How do you add a taxonomy reference select list or checkboxes to a custom field?
I'm creating a custom drupal 7 module that adds a custom compound field. For this question, I've posted part of my code below (my schema and also part of my hook_field_widget_form). It contains a ...
0
votes
1answer
100 views
How to show images below a select box according to the value?
Let's say I have a select box with values : 1, 2, 3, 4, 5, 6. Every value has it's own image, which I want to display as a description below the select field. Any Drupal / AJAX way to show this?
By ...
0
votes
0answers
19 views
Predefined and lock the name of a field in a new content type
I have made video field provided by video module generic to be used by all content types (past or future). For some reason I need everytime a new video field is created to have a predefined name e.g. ...
0
votes
1answer
59 views
Trouble setting up field instance
I have isolated my error to the field_create_instance($instance) line but can't make sense of what I'm doing wrong.
function my_module_quote_add_qid() {
$field = array(
'field_name' => ...
0
votes
1answer
49 views
How to override a module theme function in a custom module but still allow themes to override the template file?
I'm writing a fairly simple module which allows the removal of colons from field output on a per field basis and I need to override the core field module's theme_field function in my module.
I can ...
1
vote
0answers
39 views
mark single form field as cause of error on form validation
I've a custom field, and I'm trying to write the validation for the field values. however when a particular field causes the failure, the whole fielset is marked in red. I only want the specific field ...
0
votes
2answers
53 views
Is it good practice for a module to add fields to a certain content type?
I have a content type of "album" that is used for displaying reviews of music albums. It has fields like "artist", "genre", "publication_date", etc.
I also have a supporting module that displays ...
2
votes
1answer
38 views
Making a new field via module
I've been following the Drupal example on how to create a new field. I can get their example to work fine, but when I try my own it does not seem to store any data, i.e. the field is always blank when ...
0
votes
1answer
34 views
how to assign first img linked on a node to image field
What I have: a D7 site with around 2k nodes on it, many of these nodes have images <img> in the html of the body but those images are not assigned to the image field. (It is an old drupal site ...
1
vote
1answer
34 views
How do I get fields of a certain field type?
I've seen how to get lists of fields by entity and bundle with field_info_instances() and field_info_field(), but I'm not seeing a way to get all fields of a particular type.
I was able to cook this ...
1
vote
2answers
140 views
Custom form: How to implement a module's field widget
In my custom form I have a file upload, which follows the array structure of file_element_info() in file.module in core. This is consistent with examples in examples module and date module has ...
0
votes
0answers
65 views
Print term's field value on node tpl
The term reference is field_prodcat. Each term of the taxonomy has decimal field named field_jaja. I want to print the value of field_jaja to the node template
To see the value of the term, I'm ...
0
votes
2answers
51 views
How to make specific field disabled on node submit, but enabled on node edit?
In content type testtype I have 2 required field: field_one & field_two.
I need to make field_one only enabled on node submit, while field_two only enabled on node edit.
So, when submitting, we ...
0
votes
0answers
27 views
Is there a submit handler for custom fields?
I built a custom field, and now I'm adding an image upload to that custom field. The type is managed_file. When the user saves the content, where can I handle the file after submit?
0
votes
0answers
98 views
Drupal 6 alternative to Drupal 7's managed_file Field API type
Is there a Drupal 6 alternative to the Drupal 7 managed_file field type?
I have an configuration form using multiple image fields, and I'm using managed_file field type in Drupal 7 which works ...
1
vote
1answer
60 views
this hook_uninstall isn't deleting fields in my module!
I've trying to make a simple module that creates a node-type and adds a few custom fields to it with the Field API.
Here is my module's .install
Here is my module's .module
The module installs ...
0
votes
1answer
113 views
How to programmatically set a file field to allow multiple uploads/values?
I have created a file field with field_create_field() and added an instance of it to my custom node type with field_create_instance() in my module's hook_install()function. But how do I set it to ...
0
votes
1answer
51 views
Can't get drupal_array_get_nested_value to work
I'm trying to use this helper function drupal_array_get_nested_value and I can't seem to get it to run. ...
0
votes
2answers
74 views
Display form within a custom field?
I've created a module that has a 'form builder' on the admin side. Once the form has been created, I store the form array in the database. Then on the front end I've created a custom field that ...