Questions tagged [drupal-field-api]

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 "drupal-fields" for questions about fields implemented in modules you are using.

The field API implements only the part for creating fields that was part of the CCK module; it implements also the basic fields, but it doesn't implement all the fields that were part of CCK in Drupal 6.
The CCK module is still necessary for updating from Drupal 6 to Drupal 7, in a site that previously used CCK, and to use all the fields available in Drupal 6.

30 questions
1
vote
1 answer

Drupal 7: Incorporate Profile fields into form

I am developing a Drupal module that will create a new user account as part of its functionality. However, I would like to be able to include some fields that will be saved to the new user's profile when the user is created. This is easy enough for…
James Shields
  • 309
  • 4
  • 12
0
votes
1 answer

Creating new node type with custom field makes page for adding the node without any fields in Drupal 7

I'm trying to make a simple custom field "field_book_year" for the new node type "synopsis_book". I have wrote in .install file: function synopsis_install() { node_types_rebuild(); $types = node_type_get_types(); // In Drupal 7 you must…
soshial
  • 5,906
  • 6
  • 32
  • 40
0
votes
1 answer

Print fields in drupal

I'm trying to make Drupal print a list with two different fields in the same array. So first comes field A, then field B and it prints in this way until the whole array is printed. The result I'm trying to get is something like …
25r43q
  • 613
  • 4
  • 16
0
votes
1 answer

adding data to a date field attached to a node in drupal 7

I need to add data to a datetime field in drupal 7. I am tryin to use $node->field_test_a_updated[0]['value'] = $val; $node->field_test_a_updated[0]['delta'] = 0; $node->field_test_a_updated[0]['timezone'] =…
Piyuesh Kumar
  • 436
  • 5
  • 21
0
votes
0 answers

Multiple Date Form Element in Drupal 9

I am trying to add a multiple date field (unlimited cardinality) in my custom module configuration form. $form['holidayForm']['holidays'] = [ '#type' => 'date', '#multiple' => TRUE, '#title' => $this->t('Holidays'), …
perpetual_dream
  • 1,046
  • 5
  • 18
  • 51
0
votes
0 answers

Field table renamed with field_deleted_data_ and field_config , field_config_instance table set deleted status 1

Suddenly I am facing some issue at Drupal 7 site. Here in my project I user Profile2 module . We have multiple profile type. Each profile type has some field. Suddenly field_data and field_revision table rename with field_deleted_data_ and…
Arif
  • 195
  • 12
0
votes
2 answers

Drupal 8 - How to enable custom field under manage form display programmatically?

I have created a drupal8 module that programmatically created custom user fields. It display in Manage fields section but not enable/view inside Manage form display and Manage display section. I have tried to override entiry_form_display but not get…
Durgesh
  • 97
  • 3
  • 8
0
votes
1 answer

D7: Field API Field not saved when using hook_form_alter

I have the following field (as an example) created with Field API, which works great. As I want to add autocomplete functionality (already working, not shown here) as well as setting a default value from $_POST variable, I started altering the field…
0
votes
1 answer

Drupal 7 User Like node

I have been working with Drupal 7. I have a scenario where user like a particular node. If user likes the node it will increment 1 in the node field which is reference by a user by passing it UID. Now can any one give me clear documentation…
Touqeer Shafi
  • 5,084
  • 3
  • 28
  • 45
0
votes
2 answers

Add field when adding new content in Drupal

I'd like to ask a tricky question to you about Drupal. I created a new content type which includes lots of fields. I want to find a module that adds a 'Add another' link to the adding content screen which will duplicate certain fields. Example: I…
0
votes
1 answer

Drupal 7 Custom Field Widget not saving user input

I'm building a custom field module to work with our streaming video provider. As part of this, I need to grab a video based on a selected category from the provider's API. The field will need to store a number of pieces - the selected category,…
0
votes
2 answers

Drupal 7 Field api checkbox not saving

I'm trying to get a Drupal 7 Field working programmatically and it's not going well. I simply want to create a module that creates a Field with a checkbox. The module is working, the field is working but the checkbox will not save. Here is my…
Dave_____1
  • 348
  • 5
  • 13
0
votes
0 answers

Can I update Drupal user fields like this?

I want to create a membership number for every new user that registers on my site. I want the membership number to include the userID so i can connect it back in the future. The only way I can find to do this is by using db_insert into the field…
gillarf
  • 114
  • 9
0
votes
1 answer

How to add new fields to user profile in Drupal 7 programmatically

I want to develop a module that add fields to user profile in drupal 7, like phone number and CV ... and I don't know how to do that (using Database or using fields API) pls help me. Any clear tutorials will be appreciated.
aladein
  • 125
  • 3
  • 12
0
votes
3 answers

Drupal allowed_values_function does not get called when creating a field

For some reason my allowed_values_function never gets called when showing a field on a user bundle. Code: function get_business_units() { $options = entity_load('business_unit', FALSE, NULL, FALSE); $opt = bu_to_list_values($options); …
Jack
  • 9,156
  • 4
  • 50
  • 75
1
2