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

learn more… | top users | synonyms (2)

0
votes
0answers
9 views

How can I reference field values in another field on the same entity form?

Example content type that has two fields: Text field field_value with multiple values allowed. A custom field field_error (defined with field type plugin) that contains few text "properties" ...
0
votes
0answers
7 views

How to control the fields states of Content Type?

I have several fields in my Content type entity and some of them should depend on the states of others. How can I implement it? Drupal 8 I tried the hook_form_alter () , but all elements, I add ...
2
votes
1answer
16 views

Read field value and pass it to section style atributes only for node page

I have a color field in content type -> page fields. And i want to read the values of this field and pass this value as a background color(bootstrap subtheme) to element for main content ( - from ...
0
votes
1answer
26 views

How should I go about placing the content of a field from a content type into a block?

My case is this: I have a content type called 'Test Type' with 2 fields: Body (text area), Slideshow (Unlimited list of images) When I create an instance of Test Type and it renders, my goal would be ...
1
vote
1answer
20 views

8 - How do I load a Term entity from an EntityReferenceItem?

I have a content type with a taxonomy term. I can load the first EntityReferenceItem using $node->country->get(0) then I can tid doing ->target_id (and then manually load the Term object ...
0
votes
1answer
18 views

Dynamically update views field labels

I have been searching for a while, but cannot find an answer to this. How can I get access to the field name in a view (the label used in the content type)? I am trying to create an anchor navigation ...
0
votes
0answers
14 views

Field changing value to Array on submit [on hold]

I am currently using Drupal 8 and anytime i try to create or edit a node, the value of the body field is discarded and instead all i see is 'Array'. Has anyone else experienced this error, how do i ...
2
votes
1answer
25 views

Conditional fields for the field type 'managed_file' is not working in Drupal 8

I have two radio buttons Enter The Text Upload a Text File If user select the 1st option, a field of type 'textfield' will appear & if they select the 2nd option, a field of type ...
1
vote
0answers
14 views

Field data modelling

I have a content type PLACE with simple text and image fields. Now I need to add a field to this content type where the user needs to select something for each month (he can select good OR bad or ...
0
votes
0answers
22 views

Drupal 8 : Render a field collection item in a Twig template

In Drupal 8, I have a content type which use Field Collection Module like that : field_body (FieldCollection, repeatable) field_image_alignment(Boolean) field_picture (Image) field_free_text (Long ...
3
votes
1answer
35 views

Can I store a computed field as a field of a Content Type?

In content type = Person, I have these fields: - First Name - Middle Name - Last Name - Suffix In views, I have successfully concatenated the full name by adding Global: Custom text and using ...
0
votes
0answers
6 views

How can I validate a fieldset or individual fields with ajax?

On my user registration form I have multiple fieldsets, and I want to validate each fieldset individually before moving to the next one. Kind of like a multipage setup, but all on one page. Is there ...
0
votes
0answers
21 views

How to programmatically render a field collection in Drupal 8?

For "normal" fields, this works: $node = \Drupal::routeMatch()->getParameter('node'); $field = $node->field_foobar->value; print render($field); But if the field is a field collection, it ...
0
votes
1answer
23 views

migrate paragraph fields from drupal7 to D8

I have migrated d7 website to D8 version using the core migrate_drupal_ui module successfully but the paragraph module was broken upgrade path which results in final that the paragraph bundles not ...
1
vote
1answer
20 views

Drupal8 - Templating a all form in detail on same page template

I need to display a form with complex HTML structure in my custom module. And not a single field had the same wrapper structure. So I need more flexibility in my template custom.html.twig than just ...
0
votes
0answers
13 views

How to do avoid submitting and reloading the entire form during “Add more item” in the drupal admin system?

In my drupal admin, I have a custom content type input form. Basically we enter some project details and each projects has multiple credits associated. Each credit items are then added via "Add more ...
0
votes
0answers
6 views

custom link and field update

I'm wondering if and how it can be done. I'm having a dashboard built. Basically, a quicktab using views. In one of these views, there are "custom fields" where I show icons. Some are basic edit link ...
3
votes
1answer
29 views

Delete locked fields, programmatically

I have upgraded a website to drupal 8 that I found a field created and I need to delete that field as it became useless. The field is locked, and this prevents me delete it from the interface. I ...
0
votes
1answer
10 views

How to get the list of values and keys for a given list field

I want to programmatically get the list of possible key values for a field, along with their labels. For example: 1 => red 2 => blue 3 => Yellow ... and so on. How do I do that?
0
votes
0answers
13 views

Taxonomy Autocomplete - field not found

If I understand correctly field_info_field loads field information from cache. The problem occurs when trying to reach a taxonomy autocomplete for field abc:def where abcis a field collection and def ...
0
votes
1answer
49 views
+100

Cannot change an existing field's type. in field_update_field() line 240 of field.crud.inc

My instance of drupal is throwing an error. The file that is throwing the error is modules/field/field.crud.inc The error is FieldException: Cannot change an existing field's type. in ...
0
votes
1answer
30 views

Alter field value before render

In Drupal 8, I was thinking that's a simple task but it's not : function hmytheme_preprocess_field(&$variables, $hook) { $element = $variables['element']; if ...
1
vote
1answer
21 views

How do I display a help text with field form?

Is there a way to bring up a help message next to a form field as below? FooForm.php $form['field_foo'] = array( '#type' => 'textfield', '#title' => t('Foo'), ...
0
votes
1answer
19 views

How would I store a reference in a custom FieldType in Drupal 8?

I am developing a module for Drupal 8 and want to make a field on one entity that references another along with some additional data. e.g. Library A has a copy of Book B (of Edition 2). There will be ...
1
vote
1answer
29 views

Views is ignoring my field .tpl.php file when the field is used as a replacement pattern in a rewritten field

I've been trying to modify a multiple-values field in a view. I thought I'd found the answer, creating a custom .tpl.php file using the naming structures detailed in Views UI's "Theme information" ...
0
votes
1answer
29 views

How to add a class to the <a> link elements within a Multiple Values field in a View?

I have a Views field (in this case, taxonomy term references) with Multiple Values set to "Display all values in the same row", using the Link formatter and a seperator. I want to add a class to each ...
0
votes
1answer
12 views

Adding a drop down field to user registration

We are using Drupal 8 for one of our new project and we need to add a country dropdown to the user registration form. I see that we can add a select box through Manage fields section, but how do I ...
0
votes
0answers
21 views

Users Unable to Log on to Site Due to Infinite Loop (Edited)

When any users attempt to log on to site they are redirected to 'log on page' infinitely with no error message. Error log shows 1 error. The error persists as follows: '20-Apr-2016 21:52:37 UTC] ...
0
votes
0answers
21 views

Adding jquery script to calculate average

I haven't found much documentation for this (surprisingly), but it's something I could use some help with, considering I'm not a Drupal expert /or/ a jquery expert. I have a content type "Estimate" ...
0
votes
2answers
33 views

How to create a field that references a Views Block display in D8?

In D7, using the blockreference contrib module, you could add a field to a node (say) that allowed the user to reference a block. When viewing the page the referenced block's rendered content would be ...
0
votes
0answers
12 views

How to return values to widget form from view in ctools popup?

I'm writing custom field type and widget based on it. It allows to create custom entities from node page and add node references on existing nodes. There are no problems with custom entities they ...
0
votes
0answers
16 views

How to return values back to parent form from view in ctools popup?

I'm writing custom field type and widget based on it. It allows to create custom entities from node page and add node references on existing nodes. There are no problems with custom entities they ...
3
votes
0answers
33 views

How to edit output of a field in Views

I am creating REST API using Services Module in Drupal 7. I have created a View to Get lists of Groups. In this view I have added a Field privacy which will tell if the group is Private or Public. ...
0
votes
0answers
29 views

How to fix a field with unlimited values where the “Add another item” is broken?

I am working on Drupal 7.43. I have created a few months ago standard fields (text) with unlimited values. Everything was fine. Today, I can not add another item, the Javascript icon is turning and ...
1
vote
2answers
37 views

Restrict “add more” button to add new fieldset after adding 5 fieldsets

I have taken a field of type field collection in my user-profile-form and its cardinality is set to unlimited as I wanted to have "add more" button for the users. I want to restrict the addition of ...
0
votes
1answer
21 views

How do I embed a custom node creation form inside a view

I have these nodes : Company, Cars, Trucks (cars and truck have a taxonomy term to give it's type). Cars and Trucks have a field named Company wich refer to the Company node. So i can locate the ...
0
votes
1answer
16 views

Simple field to display static data

I am trying to do module with different share buttons in form of field to content type. It has no settings, I just need to enable it in admin panel and the button should appear on node. But I cannot ...
0
votes
1answer
25 views

Getting fields' Attributes in node template

I'm trying to rendering node's fields directly inside a node template. This is my node template file node--homepage.twig.html: <div{{ attributes }}> {{ title_prefix }} {{ title_suffix }} ...
0
votes
1answer
42 views

How to add an image upload field in a custom Field Type

I'm defining a new custom Field Type in Drupal 8, let's say MyFieldType, with custom widget and formatter also. Such Field Type should have these two fields: text: a simple text value image: a ...
1
vote
2answers
31 views

How to implement moderation of data entered through user profile pages?

I am in need of a means of moderating data entered through a user's profile page, or at least for certain specified fields, both upon initial submission and after any revision. These are fields that ...
0
votes
1answer
27 views

How to change the edit form layout for custom Field Types in Drupal 8

I created an Address custom field type, with two text fields street and city. When I add a new field of type Address on a content type I get this form inside the edit page: How can I change the ...
1
vote
1answer
20 views

How to get the data of field collections

I have one field collection with 4 fields. How to get the data of field collection in views tpl file I am trying to load data as field_collection = entity_load('field_collection_item', ...
0
votes
0answers
8 views

Field update permission per role

I want to provide specific users of certain ROLE (eg reviewer) to update only couple of fields of a CUSTOM Node. I'm using FIELD PERMISSIONS to set up field permission. I've set up ROLE permission ...
1
vote
1answer
36 views

Getting an error adding a new field with a custom Field Type in Drupal 8

I defined a new Field Type named country following this nice tutorial: http://capgemini.github.io/drupal/writing-custom-fields-in-drupal-8/ These are main files from the country custom Field Type: ...
0
votes
0answers
10 views

field_view_value() returns no items in Computed Field

I am trying to compute the value of a field using the Computed Field module. I need to get the formatted value of a field field_get_items() and field_view_value(). I think there should be no problems ...
1
vote
1answer
30 views

How do I completely overwrite an array in JSON serialized data field

I am storing an array as a JSON encoded serialized data field in Drupal 7 using the Serialized Field module. If I have an array of 20 elements and try to overwrite it with an array of 10 elements, I ...
0
votes
1answer
17 views

Overriding field label

I'm trying to override the label of the picture field. I've started with the code here: How to change the field label on my registration form? Drupal 7 function mymodule_form_alter(&$form, ...
1
vote
1answer
29 views

How can I save form data on a node in Drupal?

I want submit form data and save on specific node but I don't know that how to do? function test1_menu() { $items['mytest'] = array( 'title' => 'My Tes', 'page callback' => ...
0
votes
1answer
36 views

Allowed column type names and element type names for creating custom Field Types

I'm creating new Field Types in Drupal 8. I recently asked which are the type names allowed for the DataDefinition::create() method, receiving a good answer. Now I figured out that I need at least ...
0
votes
1answer
14 views

How to add another html tag (i.e. span) before the field value renders using hook_preprocess()?

I have a field (field_txt) that renders properly, but now i want to add a tag around it so that i can style the background color of it. How would this be possible using the preprocess field hook? ...