Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [entities]

Nodes, comments, taxonomy terms, and users, using the terminology used since Drupal 7, are generally called "entities."

0
votes
0answers
14 views

Why does this entity form when saved create a new instance rather than save the present one

This may be a question which only the most familiar with the module EntityForm can help with. My situation is this. I have a content type called project and each node has an entity form attached to ...
0
votes
1answer
42 views

How to force the allowed number of values of a custom field to 1

I'm creating a custom field. How do I force the number of values to 1? All the answers I find are for Drupal 7.
0
votes
0answers
25 views

How to query for field entites

I want to search in a particular field by field instances, not related nodes. There should be a row of results for every matching field, that's why I'm not using an entity field query and searching by ...
0
votes
0answers
19 views

How I get the entity reference contet type field value in a view?

I have a two content type A and B, In 'A' content type I have added one Plain Text field called Instrument. and In 'B' content type I have added entity reference field of content 'A' called Music Band....
0
votes
0answers
21 views

Change Add comment form but not Edit comment form, and vice-versa [duplicate]

I have a comment type named "reviews" (it happens to be a field in a node that's displayed alongside webform submissions). I'm trying to differentiate between the add comment form and the edit ...
0
votes
0answers
48 views

How can you unset entity view display component with config override?

I have an entity view display configuration where I would like to "unset" a component (one of the field). I implement the ConfigFactoryOverrideInterface with the right service configuration. Is there ...
1
vote
1answer
77 views

how to reinitiate a default field value every time the content edition is loaded?

i have a field that , if opt-in, send notifications. I would like that when editing the content , the value is always reinitiated to opt-out, sitll leaving the possibility for the editor to opt-in ...
0
votes
0answers
28 views

Attach/ Display same Fieldset for every checkbox option

how do I re-use a fieldset/group for each checkbox option of a List field. [Please see the form mock-up attached] "Samples collected" is a List(check boxes) field with few options (one, two, three, ...
0
votes
1answer
26 views

Extract data from Field Collection using db_select()

I'd like to use db_select() to extract values from a field collection attached to the user profile, to help speed up some complex Ajax forms (rather than loading the entire field collection, using ...
0
votes
1answer
19 views

Copy data from a selected view in a fieldcollection field

I have content_type TYPE1 content with two fields: fiedl_1 is a viewfield type that allows me to display a view inside a node. fiedl_2 is fieldcollection type. Is it possible to copy the rows ...
0
votes
0answers
43 views

Unable to evaluate action commerce_shipping_service_rate_order

Right now, I am using Drupal 7.59, PHP 7.0.30, Commerce shipping 7.x-2.2, Commerce UPS 7.x-2.0 and Entity API 7.x-1.6. when I take an order through to checkout and then return back to the cart page. ...
2
votes
1answer
61 views

How to find unused or old twig template files?

There are times when fields are deleted from a Content type, but there is no way of knowing if there is a related field twig template without manually looking in our repository. Other than looking ...
-2
votes
1answer
213 views

print fields in form

I add this code function Yourtheme_theme_suggestions_alter(array &$suggestions, array $variables, $hook) { if ($hook == 'form' & !empty($variables['element']['#id'])) { $suggestions[] ...
0
votes
0answers
36 views

Count Distinct Field collection items in attached views

I have a content type with a field collection (unlimited cardinality). In this field collection there is a select list with around 40 values. In a list (filtered by taxonomy) I show multiple nodes of ...
1
vote
1answer
427 views

Set value for custom field

I created a custom field but I don't know how to set a value. I can read values with $entity->get('field_myfield')->getValue()[0]['data'] The field consists of several elements: value, data, ...
1
vote
0answers
327 views

Field template suggestions

Having trouble getting HOOK_theme_suggestions_field_alter to do what I expect. Think I'm missing something key about naming precendence. Tiny bit of context: I have several field--xyz.html.twig ...
3
votes
1answer
457 views

How to add variable using mytheme_preprocess_field and print using twig template?

We have a content type Article that has two custom fields: field_header and field_link. When field_header is not populated, we want to perform validation in twig template to add a CSS class. When we ...
0
votes
2answers
87 views

Custom Field Plugin With Image Field

I have been working on a custom field plugin with which the aim is to create a custom field to be used for content and will consist of a link field and a file field through which a thumb image is to ...
1
vote
1answer
35 views

Where are entities stored in MySQL by default?

Drupal 8 has a powerful entity API that manages all the content of the entities. How can these entities be accessed outside of Drupal? Which are the tables and what is the format?
0
votes
1answer
14 views

How to transfer data from the program's created field to the standard text, while saving the node?

Using hook_form_alter(), I created 4 form fields. When saving a node, I want to extract data from them and transferred to a standard field. Using foreach(), I can form a string and then transfer it ...
0
votes
0answers
55 views

Get image of taxonomy term of referenced content type B in content type A twig template

I'm trying to display an image in a twig template. My content is organized as follows: I have a content type A ('Lesson') that has an entity reference field that references a content type B ('Series')...
1
vote
2answers
42 views

Tracking field deletion

How to track user activity to find the user behind the field deletion. As an admin, I want to track user activity so that I can find the user who deletes the field from particular content type. I ...
0
votes
1answer
40 views

Brackets in URL Field Get Reformatted to %5B%5D

I have a Drupal 7 site with a content type that includes a link field. The intention is for staff to add a link that can link to an outside website. But if that link contains brackets [ ], the module ...
1
vote
1answer
87 views

How do I use a display mode for anonymous users, and another one for logged-in users?

I would like to change the display mode only for entity.node.canonical, so that a logged-in user would see something completely different than anonymous users. For example, an entity displayed by ...
1
vote
1answer
93 views

Error : No eligible views were found. Create a view with an Entity Reference display, or add such a display to an existing view

I cannot work out some basic stuff ... what do I not correct? Using D8, distribution varbase. I would like to create a reference from one content type to antoher in D8 so a user is able to use a ...
0
votes
1answer
189 views

How to convert a timestamp field into a date field?

Is there a way to convert the data of a timestamp field into a regular date field in Drupal 8? preferably without coding or making a new module.
3
votes
1answer
43 views

Programmatically set class on extended field type

Earlier I created an extended version of the Node class. I called it AbleNode and it extended BaseNode. In order to set all nodes to this node type I added this to my custom .module file function ...
0
votes
0answers
51 views

Mixed entity types. How to create a view of nodes and groups?

I want to create of view of nodes and of groups (group module). Being different entity types I am not sure if this possible. Is there a method by which this could be done? There is no specific ...
0
votes
2answers
246 views

How to update custom content type fields value in bulk?

Is their any way to provide the bulk edit in the custom content type fields values by csv or in bulk.?
0
votes
0answers
17 views

make a child entity form field required based on parent entity form field selection

Suppose I have two content types "job_opportunity" & "application". job_opportunity content type has following fields: salary job_type resume_required_or_not application content type has ...
0
votes
1answer
29 views

How to read-modify-write a multivalue entity-reference field

I have some D8 entity code that does read-modify-write on a multivalue entity-reference field. The modification required is to change references to one entity to refer to another, without changing ...
0
votes
0answers
243 views

How do I use a custom Field Formatter to display multiple rows in views for multivalued field?

On my Drupal 8 site I'm trying to create a view of a custom entity that contains a custom field type which is multivalued in the entity. It works fine when I try to display the multiple values on the ...
0
votes
0answers
85 views

Creating entity type using console doesn't work

I've installed Drupal 8.5.4 and followed these two steps to create a module and an entity type: Ran drupal gm and filled in the info Ran drupal geco and filled in the info (No bundles, No translation,...
2
votes
1answer
48 views

How to handle a node translation containing an entity reference with a managed field property

I have a custom field that contains a managed file. The node that the field is attached to and the field are enabled for translation. I create a piece of content, which defaults to the site default ...
0
votes
0answers
20 views

Field in Field Collection not displaying

Running Drupal 7.59 I have added a field to a field collection using the Structure->field collections->(collection) menu I edited a page where the field collection is used, and added content to the ...
0
votes
0answers
31 views

how to programmatically set unpublish_on

How can I programmatically set the unpublish_on field(scheduler module) for a node entity in drupal 7? $entity = entity_metadata_wrapper('node', $node); $entity->language(LANGUAGE_NONE); $entity-&...
0
votes
1answer
87 views

Trying to print translated field label/values to twig

I have been trying to figure out how I can print or display the translated values based on the current language of the page. I have tried using some of the following options {% trans %} and {% ...
1
vote
1answer
86 views

How to progragrammatically get NodeType translated value in D8?

Fetching node translation $node = Node::load($nid); $node->getTitle(); // returns title in en(default language). $translated_node = \Drupal::service('entity.repository')->...
0
votes
1answer
401 views

How to get field label from a field machine name

$fields = \Drupal\Core\Entity\EntityTypeManagerInterface->getStorage('field_storage_config')->loadMultiple(); This is listing me all the fields. foreach ($fields as $key => $instance) { ...
0
votes
1answer
23 views

Add “n” fields when click on “Add another item”

When I click on "Add another item", It should create 10 new fields. Is there a way I can do this?
0
votes
0answers
73 views

How to print url only from link field in views-view-fields template

In my views-view-field--NAME.html.twig i would like to print the url only from my link field with the machine name of field_link. I am planning to use them seperatly. see below. {{ fields.title....
0
votes
1answer
20 views

Can computed fields be added to a custom entity?

How can the "computed field" contrib module's (drupal7) fields be added to custom entities (based on the entity API module)? Or will the computed field work with nodes only?
0
votes
0answers
14 views

Theming Content Link Field

I have a link field type called 'field_cta'. What I am trying to do is get the value of the class and print it out in my html code. For example: I have tried the below in hopeful that I would be ...
0
votes
1answer
20 views

Provide name for Entity Reference

Is there any way referenced entities could be named in a meaningful way? Currently when I am creating a custom view and need to reference some entity, I have tens of entities that are named exactly ...
3
votes
1answer
95 views

How to get node url/address from entity reference (content type)?

Is there a way to fetch or print the node url/address from a entity reference to my twig template. I have already tried {{ related_links.entity.uri }}, {{ related_links.entity.url }} or {{ ...
1
vote
1answer
548 views

How to print the file description to my twig template?

I'm trying to figure how I can obtain or print the file description that is uploaded on my node and display on my twig template So far I have tried {{ file.entity.label }} which only prints the name ...
0
votes
0answers
15 views

How (if even possible) can I get a field value from an unsaved parent entity to use in a referenced entity?

I have two media types: Document (main) Name DocID Description Year Main file (file reference field) Supplemental files (optional, multi-value media reference field) Document (supplemental) Name ...
2
votes
2answers
500 views

How to get height and width of image style?

We have a custom module mymodule where we call mymodule_tokens so that we can assign custom token values from the current node. These custom tokens are used to insert values in the Article's MetaTag ...
0
votes
1answer
63 views

Get relationships between tables when no foreign keys are present

How can tell the relationships between tables when no FKs are being used? Just started working on a (partial) data export from Drupal MySQL database with ~1000 tables that contains hardly any foreign ...
0
votes
1answer
38 views

Convert boolean field to custom style [closed]

I have a Boolean field with Yes/No values with default style of Drupal . I want to change that field to ON and OFF toggle style like below . I understand that it can be done using the bootstrap ...