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

learn more… | top users | synonyms (2)

1
vote
2answers
15 views

How to access form elements in table via getValue()?

I'm trying to do so using array indices. Say, we have $form['mytable'] = array( '#type' => 'table', '#header' => array(t('a'), t('b'))); $form['mytable'][1]['a'] = array( '#type' => '...
0
votes
0answers
8 views

Field validation rule for date popup field using Date range2 Field Validator is not working in drupal7

The requirement is to display only the current day and future dates on the pop up calendar. Using field validation module and with reference to the solution related to the post how to set date field ...
0
votes
1answer
14 views

How to hide particular field for specific role?

I have Article page content type with field title,description,ad_article_top,video etc. Also have one other role writer.writer can create article page content. My issue is how to hide the ...
0
votes
0answers
10 views

Exclude entities which don't have specific value with EntityFieldQuery [duplicate]

Let's say I have entityreference field in my content type which could have unlimited number of values. How to query for entities which doesn't have specific value in this field. $query->...
0
votes
0answers
14 views

Theming a form input to use an external bootstrap library

I have come across a js/css library that extends bootstrap to incorporate some custom input controls. Therefore, I want to be able to extend the default checkboxes generated by drupal 8 to take on the ...
0
votes
1answer
14 views

Resizing image from one field and save result in another field

As mentioned on the comments on this question, on my node-editing-form there are fields for WIDTH, HEIGHT, and an IMAGE. I would like to resize the given image by the dimesions WIDTH and HEIGHT and to ...
2
votes
1answer
31 views

How to add new form field dynamically on selected change using ajax

I'm trying to make dynamic form in my module: I have one field of type select containing some options, and when selecting one option a new field should be added dynamically to the form which in turn ...
1
vote
2answers
13 views

Print just the value of Views field inside of views-view-fields template

I cannot for the life of me figure out how to print the value of a field in the 'fields' template. Currently, I'm doing this to strip the unnecessary html (don't laugh): <?php $shortContent = $...
0
votes
0answers
22 views

Existing image field is not appearing in views

I am having a trouble with displaying existing image field of article content type in views. It's not coming while adding a field in views to display. I am using drupal-8.1.x, also I have tried to ...
1
vote
1answer
34 views

How to validate dependent fields for a content type?

In one of my content types I have 1 field 'venue' with a drop down option. If I select 'venue' as 'other' from the drop down, some other fields (say 'venue address' and 'venue name') should become ...
0
votes
0answers
20 views

Remove registration fields

I want to delete the state field on the registration form (among other fields from the registration form). How can this be done in drupal 7? I've tried to delete the field in the section: Home » ...
0
votes
0answers
14 views

Filed collection element counter on field collection tpl

I have created field group using field collection module and field collection tpl for theme. Data rendering working fine but I need counter variable before render on this tpl file. How to get ...
0
votes
0answers
12 views

Search filter for form field with multiple values

I have a field with multiple values allowed. I need search box to search through all the values of field. For example: My field is "progress notes" values allowed unlimited and it is multifield type.
3
votes
0answers
23 views

Is it possible to add a button to a field_collection?

I've created a custom entity module, and the form for it uses field_collections. The only form field I've defined programmatically is the title, the rest of the fields and field collections for this ...
1
vote
1answer
28 views

How can I get the field settings in a field preprocess hook?

How can I get the field settings in a field preprocess hook?
0
votes
1answer
26 views

Showing empty fields [on hold]

I have created a profile type using Profile2 module and created some fields (generic files, editable and a date) and I want it to display even with no result. I have created an empty text (in case ...
0
votes
1answer
54 views

How to delete a custom field type and its data while uninstalling a module? [on hold]

Which function can I use in Drupal 8 to delete a content type's custom field type and its data while uninstalling a module? I tried this in hook_uninstall(), but it doesn't allow me to delete the ...
0
votes
0answers
19 views

Hide values in Autocomplete (Tags style) field not matching contextual filter

I have an Autocomplete (Tags style) field with multiple values in the field. I'm using contextual filters to display nodes with one or more values in the Autocomplete field matching the filters. I ...
1
vote
1answer
31 views

How do I show a percentage value in a views_field?

How do I show the percentage value in a views_field? col(1) (group by) field_a col(2) (count)field_a *100/number of results " -->@total" I'm still not able to use @total in a computed_field or a ...
2
votes
3answers
65 views

How to add “Content type B” from within “Content type A” and then display both together?

I have the following scenario: Content type A Content type B Content type A is added by the admin role. Content type B is added by the students role. Once Content type A is created, then on ...
3
votes
1answer
54 views

Set the value of a date field

I am trying to set the value of a user field which is a date. If i check the database, the date is in this format: 2016-06-30T07:52:51 I have the user ID and a new Unix timestamp value that I want ...
0
votes
1answer
42 views

how to load retrieve form value from custom element

i just done build a custom element based on this tutorial: https://docs.acquia.com/articles/drupal-8-creating-elements-theming-elements-and-managing-frontend-libraries so let say my element type is "...
0
votes
1answer
17 views

Create a subtype of Panel & style it with a template

So I'm trying to build a independent Landing Page for an event on our drupal 7 site. I would like to have the page contain a different main navigation menu then our site and also has the functionality ...
1
vote
3answers
35 views

How can I programmatically render a node's field respecting the view mode settings?

I want to render a node's field inside a block. It works like this: <?php if ($node) { if (isset($node->field_body_secondary) && $field = $node->field_body_secondary->value) { ...
0
votes
2answers
42 views

How to get tid on behalf of node id (nid) in Drupal 8?

I am new in Drupal 8. I have created a node with category (taxonomy). Now I don't understand how to get tid by using nid. I am using $node->body->value to get the body field value and use {{ ...
-3
votes
1answer
53 views

Creation of a Content Type to Meet Required Use Case

How do I achieve the following Use Case? Use Case Example Widgets, Inc. offers franchising opportunities. They have 3 different franchising levels (bronze, silver and gold). Widgets, Inc. needs to ...
0
votes
1answer
71 views

Use a custom field with a custom entity

How can I use a custom field with a custom entity? Based on Drupal examples, how I can use field_example_rgb (from field_example) in my own custom content entity with bundles? I will add this field ...
0
votes
2answers
43 views

How to make the radio field checked by default?

I have a field group which consists of a radio box and other fields. This field group can have multiple values. My radio box field have two options and the first is checked by default. But when I add ...
2
votes
2answers
145 views

Which table stores the content type fields?

I have a content type in drupal 8 and which table stores the content type fields and type in drupal 8 ? Unlike in drupal 6 (in which there will be tables specifically for content types) like ...
2
votes
2answers
63 views

How to create a price list easily with Drupal 8 core (Responsive tables)?

I need to create a node price-list in Drupal 8 - A node like any other featuring a price list I could update easily; I prefer doing it solely with the (very rich) Drupal 8 core, without installing any ...
2
votes
1answer
30 views

How to add link title in combine field filter

my view having combine field filter.it is working based on link field. the link field title is "test" and the url is "http://example.com".when i search using "test" it is not showing any result.if i ...
0
votes
1answer
36 views

Term reference field won't display

I'm trying to add tags to my blog posts on my Drupal 7 site. I've added the Term Reference field to the content type and when I add a blog post it is letting me add tags without a problem, however ...
0
votes
1answer
23 views

How to change a file field value with entity_metadata_wrapper

I need to remove a file field value, and instead, assign a new value to it. The file field contains video and the new video is in the videos directory. This is my code to delete a file field value (...
-1
votes
0answers
12 views

Replacing a video file doesn't take effect in the player

I am building an online video editor. The video is played and users can cut a segment of the video and replace the result with the current video. The video file is stored as a field in a content type,...
0
votes
1answer
20 views

Ajax request return field without name attribute

Instead of getting multiselect on making ajax request while I select content type, I got single select and this select hasn't any name, so here's problem and I don't know how to fix it. can anybody ...
1
vote
1answer
22 views

What Plugin goes “type” of a FieldStorageConfig type?

I have a module creating a field type. It works. I can create and add the field through the admin UI. However, I am trying to update a content type with hook_update_N and change a field from entity ...
6
votes
1answer
176 views
+200

How to check for entity access when displaying views fields?

I have a custom entity. There is an access callback defined in hook_entity_info() and it is called when I access the entity. Also in views when I select to display rendered entities, the entity is ...
0
votes
2answers
33 views

How do I query entities to get all fields values - including referenced ones (INNER JOIN)

I have custom content types in my Drupal 8 module and want to query nodes of those content types programmatically. Querying through entityQuery is easy. However, I have also entity reference fields (...
0
votes
1answer
57 views

Add text field to poll entity

I have installed the Poll module in Drupal 8. I need to add a field to it, such as a text area for the poll description. How can I add a field to a content entity like Poll, which is not a content ...
0
votes
0answers
27 views

How do I get a custom help text on a link field if title of the field is hidden?

I created a link field, and disabled its title, put some custom help text for the link field. It only shows the default help text underneath, like below but with no custom help text. Start typing ...
0
votes
0answers
34 views

Randomly dropping fields

I’ve been seeing an issue while using Views on Drupal 7 that I can’t seem to explain, track down, or reliably reproduce. It’s completely baffling! I’m running a d7 site with a fairly small set of ...
3
votes
1answer
27 views

Disable select option

I have a select list in my registration form here. The user can select 3 options to register for the event. For now the user has the ability to choose an early bird registration. After the periode ...
0
votes
0answers
10 views

'Text format field is required' error when saving Better Exposed filters (BEF)

For one of the views exposed filters I'm using BEF but when I'm trying to save one of the filters as checkboxes/radio buttons it give me below error. I've no clue to what I'm doing wrong. Any help ...
0
votes
1answer
33 views

How to automatically update field values for all translated nodes

I have original node which is in english. Then I have another node which is a translation of the original node. Both of these nodes have the same image field. When I update the value - change the ...
0
votes
1answer
39 views

How do I update a field to use a different field_type?

I have created custom field_type for a field in my content type. The field 'field_content_category' already exists and is an entity_reference. Changing the yml file and importing doesnt work because ...
1
vote
0answers
30 views

How do I clean up the tables for the deleted fields?

There are many field_deleted_data* and field_deleted_revision* tables in my database. I found Clean Deleted Field from Database, but it is for Drupal 7, not Drupal 8. I tried running drush eval "...
2
votes
1answer
34 views

How do I create an Events page listing all Event nodes?

I have a Theatre website that I'm creating in Drupal 8, and I need to create an Event content type. This content type will be displayed on an Events page listing all Events in ascending order from ...
0
votes
0answers
17 views

Enable for submit button only when Date is selected (disable if date empty)

I have a form which has a Date field with end and start date. I've created following states properties which seem to have some effect since submit button has new class form-button-disabled. Though ...
3
votes
1answer
17 views

How to populate field X with value of field Y in Organic Groups?

I want to use rules in order to populate Organic Groups field X value with the value of field Y. Keeping in mind these fields are Organic Group fields. Field X is a 'long text & summary' field, ...
1
vote
2answers
27 views

Render only one field of an entity

On my controller for a custom page I've loaded an entity and I want to render, on the template for this custom page, only a field of the loaded entity. I would like to get the render array for this ...