Fields are custom data that can be attached to Drupal entities.

learn more… | top users | synonyms (2)

3
votes
0answers
13 views

How to use RegexConstraint with field?

I'm defining a base field for my custom content entity: $fields['machine_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Machine name')) ->addConstraint('UniqueField') ...
0
votes
1answer
18 views

How to programmatically add options to list_text field

I want to programmatically add a drop down list field to the user profile via a custom module. How do I go about adding select options for the field? // Create Field 'suffix' => array( ...
0
votes
0answers
17 views

How to force field deletion?

I'm stuck with uninstallable module. Drupal insists that there are Fields pending deletion and that module can not be uninstalled. I've run cron zillion times already as advised for such situations ...
1
vote
1answer
32 views

How do I display a taxonomy term, without a link, in a node template?

In learning, I've created a custom content type called story and a custom taxonomy called story_category. In story I have a term reference for story_category. I can render a taxonomy term associated ...
0
votes
0answers
8 views

How to move Date Information on a node [on hold]

I've got a node that has several fields, and I would like to move the date information (without the author) to a specific point in the node's display. Editing node.tpl.php doesn't seem to help, as ...
0
votes
1answer
14 views

How can I update the field of the entity?

I have an "Question" entity, and I need to updates its 'key' field (of string type): My code isn't working: $storage = \Drupal::entityManager()->getStorage('question'); $query = ...
0
votes
0answers
16 views

How to get to field items after entity is built but before field formatter view method?

I want to do some alterations to fields before they are displayed on an entity and it looks like it is not possible because the ...
1
vote
1answer
11 views

How to hook into field creation (form successfully processed)?

I need to act after field has been created (new db table). Actually I need to use data from the first field form: field-ui-field-storage-add-form So ideally I need to hook on this form being ...
1
vote
0answers
24 views

Performance or other implications of sharing fields in Drupal 8?

There already exists quite a popular question asking about the implications of sharing fields between node/entity types: What's a good balance between reusing fields versus creating new ones in ...
0
votes
0answers
16 views

Taxonomony Widget Form Field with multiple fields

Hi people am a newbie in Drupal hooks, until this time i never did need write a hook. But now i need write a widget fieldwith various elements to search and store multiples terms of a taxonomy. I did ...
0
votes
1answer
18 views

How do I render form fields in my custom.tpl.php template?

Here's my dilemma, I built a custom form-based module that allows a user to vote on a future conference location but I'm having a issue printing or rendering my form fields to have them display in my ...
0
votes
0answers
16 views

How can I show just price field in page--node--add--[content type].html.twig

How can I show just the price field (field_price) in page--node--add--[content type].html.twig, something like {{ node.field_price }}?
4
votes
2answers
173 views

Entity reference widget

I know that in Drupal 8 the taxonomy term reference is deprecated and it's implemented by an entity reference in Drupal 8 Core. Is there any widget to select items by checkbox list instead of the ...
0
votes
0answers
6 views

Display every referencing node of a type in one table row, while still being able to use exposed filters

I've got a content type "Examination" that has about 8 possible types. It references a node which I later use to display a table with all the data. The main node might be referenced once by each type ...
0
votes
0answers
23 views

How do I define a computed field equal to the concatenation of two fields of my custom entity?

I have a custom entity (Person) with these fields: ID, nom, prenom, telephoneportable, estactive, userID, created, changed. I created it with baseFieldDefinitions. I want to have a computed field ...
0
votes
1answer
19 views

Trying to create a user with an entity reference taxonomy term using services

So I've been trying to create a user with an entity reference taxonomy term, however for some reason it doesn't seem to work. I've noticed that it depends on the widget used, but I've tried every ...
3
votes
2answers
54 views

How to compare the already saved value of node and updated value?

I want to programmatically compare a field value of a node in hook_node_update(). How can I get the already saved and the updated values?
0
votes
0answers
12 views

Insert a form into a webform

i've created by the backoffice a webform and now i want to add the user_profile form (and modify it to include only fields i want) into this form. I don't know how to do that, i've tried this but this ...
0
votes
1answer
16 views

Cannot get value of form field of type 'file' in drupal form

I have a form field such as , $form['fileTransfer_settings']['file_path'] = array( '#type' => 'file', '#title' => t('Choose file'), '#size' => 22, '#description' ...
0
votes
0answers
14 views

Feeds Api conditionally skip deletion of terms

I have a taxonomy vocabulary of customer addresses as terms that I maintain via the Feeds module. Most of the terms will be added via the Feeds import, however I want users to have the ability to add ...
0
votes
1answer
42 views

Body field doesn't display in any view mode

I inserted some articles in my Drupal 7 site, the body field doesn't display, the manage display setting is ok, I tried to change the theme. Even though I still to display it in edit mode. One thing ...
3
votes
3answers
62 views
+50

Treating string field as numeric to use as an exposed filter

I have a field in my users' profiles that has been defined as varchar initially even though it holds numeric values. I'm trying to use that field as an exposed filter and perform "greater than or ...
0
votes
0answers
7 views

Entity Reference of Taxonomy Term to Show Fields and Multiple Items in View

I have a taxonomy with parent / child setup. Vocab: -Parent --Child1 ---Custom Field ---Title (label) ---Term Description --Child2 ---Custom Field ---Title (label) ---Term Description I am using ...
1
vote
1answer
11 views

field_attach_update stopped working - how to debug this?

I am using this simple code: $order = commerce_order_load($order_id); $order->status='completed'; field_attach_update('commerce_order', $order); To update the status of order to completed. This ...
0
votes
0answers
20 views

Position taxonomy header image field in template

I have a list of taxonomy terms to structure my content. Apples Oranges Bananas In admin/structure/taxonomy/manage/catalog/overview/fields I added the field_header_image (an Header image field). ...
1
vote
2answers
18 views

How can I construct a table view with columns passed as a parameter?

I have a content type, referenced by multiple subsequent content types and at some point I made a spreadsheet with all that data. My new assignment is to display a view like that and then export it to ...
0
votes
1answer
7 views

Field as Block column not showing

I installed the Field as Block plugin without problems, but when I go to Structure > Content Types > Basic Page > Manage Display, I still don't see the "Display as block" checkbox. I tried googling ...
1
vote
1answer
35 views

Drupal Commerce Stock Availability or Out of Stock

I am working on Drupal Commerce website. Using Commerce Stock I am able to manage the inventory but on product details page I want to print the following. Availability: In Stock or Availability: ...
0
votes
1answer
49 views

How to store Ajax Return value into variable after clicking the Submit button

I have created form with fields of State and City. After selecting the state appropriate city records will be loaded into city field till now working fine but after clicking the submit button I am not ...
0
votes
0answers
35 views

How do I change a form name attribute to something else?

I'm using a Drupal 6 custom form, and I want to change the form name attribute to something else. Is this possible? For example, I have this. <input type="text" name="field" maxlength="128" ...
0
votes
0answers
33 views

How to save custom field widget form values using ajax

I have created a custom field type with a save button and I want to save this values without submitting the node save button. How can I do this? Please see the screenshot if you are not clear. ...
1
vote
1answer
11 views

How to generate 'tag' field in form config module?

I'm need to create a tag field (the field that you see in this stackexchange.com website for tagging) I'm wondering is there any api for this or this has to be created from scratch? If this has to ...
0
votes
2answers
28 views

Template for custom content type

I created a module which creates a content type called equipment. Which includes multiple fields and a field collection. But now I want to style the template with those fields. As suggested from the ...
0
votes
1answer
27 views

Content entity form not displaying the previously selected value

Even though I can see that my data is being saved it doesn't ever appear to be set when I go back to edit my entity via a form. Am I missing something in my setup? Here's what I have: ...
1
vote
0answers
8 views

How to create a custom translatable field of two existed fields?

I need a field composed of two fields (widgets): term reference and textarea. Also, it must be translatable. Field collection is not translatable and double field doesn't support term reference. ...
0
votes
1answer
26 views

How to get the fields of the entity?

I need to get all the names of the entity, my entity is called 'a_process'? How can I write such query in Drupal 8 ? $nodes = entity_load_multiple('a_process', $name); Thanks in advance
0
votes
0answers
11 views

Programmatically fields translation problem , there are no results

I use standard script for make translation, core Drupal7.41, Entity translation 7.x beta 5 & internalization module - all modules installed and enable. external php script: $node = (object) ...
0
votes
2answers
39 views

Referencing a paragraph field in a field--node template

I need to reference field_role from a paragraph inside of a field--node template. The paragraph is an unlimited repeating field in the content type. The field template I am working with is the field ...
0
votes
0answers
14 views

Replace field collection by a field that can handle multiple references values

I need to improve my current usage of field collection. See attached image. I have a content type A, which has Field Collections (FieldCollection A1). In each FieldCollection Ax, there are several ...
0
votes
1answer
25 views

Suddenly unable to add a field to a new content type

When editing a content type I was going to add a simple boolean field to an existing content type. When attempting to add the new field Drupal threw an error. After a few more attempts to add a field ...
1
vote
1answer
33 views

How do I update all nodes?

I have a custom module which creates a new field with a computed value, which I need to update. How do I bulk update my nodes for a specific content type?
0
votes
1answer
39 views

How to create an 'Upload a file' field?

I have a content entity type, and I would like to have an 'Upload file' field. I have declared the field in my Entity class $fields['file'] = BaseFieldDefinition::create('file') ...
0
votes
0answers
22 views

Create new field in ajax treatment

i want to add dynamically some fields in my form. It works but i don't know why but my new rows are always created in the top of my page :/ This is an easy code example : function my_form() { ...
0
votes
2answers
19 views

How to set the field validation

I have a field which is select list in content type, now all i want is when i select the same value from that select list and try to create the content for 2nd time for same value from select list it ...
-1
votes
0answers
29 views

When “date and select list” field values are selected, automatically calculate and display result in a textfield

I have a webform which contains: a date field ("Start Date") a select field ("Duration" with options "3 months", "6 months" and "1 year") and a textfield with read-only access (End Date) Aim: When ...
1
vote
1answer
24 views

Is there a token for the key of a text list?

I need to get the key of the key|value pair from a text list field in a token. Say the field configuration shows the following options: no|No Way Jose! yes|Why yes, that'd do nicely! and the field ...
0
votes
0answers
7 views

Custom field type not showing up in view

I have created a custom field using field api. But the field value is not shoing in my view in the font end. I can select the field in my view (while creating the view). Any idea?
0
votes
0answers
11 views

size chart link

I have a drupal commerce website with different products like shirts and pants etc... On product detail page I want show a link to display the size chart. For shirts the size chart is different and ...
1
vote
0answers
13 views

Fields vanished in node edit form

In node edit form, I am not able to see any other fields other than body field. Though the field values are displayed in the node view page. For debugging, I tried to print the form value in form ...
0
votes
0answers
21 views

how to fetch value from grouped form fields after ajax is fired under conditional select type

I also used dpm($form_state->getValue('input_select','text')); and dpm($form_state->getValue('input_select','body'));its after the ajax handler is called... what is the right way to fetch value ...