Questions tagged [entities]

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

Filter by
Sorted by
Tagged with
-2
votes
1answer
18 views

I would like to create a content type - a static page that can be updated and searched for - that contains multiple content types in a specific order

The "new content type" would consist of several other content types. 1) Company with multiple fields (text, URL etc.) 2) product class (label, text) 3) product class description (label, text)...
0
votes
2answers
29 views

Get parent entity in media preprocess hook

I am having a paragraph with a media entity ref field "field_paragraph_image_ref". I would need to modiy the media twig template depending on a field value of the parent, which is a ...
1
vote
1answer
40 views

Add a new column to the backend

I am trying to add a new column to a table and I added the column using hook_update_N(). function cca_update_8902(&$sandbox) { db_add_field('cca_findings', 'cca_topic_id', array( 'type' =>...
-3
votes
0answers
29 views

Cardinality of sub fields

In code, can I set cardinality of a subfield of a custom field? So the main parent field could be a single instance while some of its subfields could have multiple instances, with an 'Add more' button ...
0
votes
1answer
44 views

Custom block disable caching?

I've created a custom module to show On This Days in a block but they are not changing each day until I flush the caches. I call the entity: public function build() { $query = \Drupal::entityQuery(...
0
votes
1answer
61 views

How can I create a custom field type for a select with multiple values?

I need a field type with 3 select in it. The field type is created and works like a charm but I'd like one of these select may have multiple values. What must I change? I add '#multiple' => TRUE, ...
0
votes
1answer
13 views

Import data using ECK and feeds module

Is it possible to import data from CSV file and insert all in two different entities for example I have created two different entities, cadidates and exams entities, once I import data to exam entity ...
2
votes
0answers
24 views

Do fields that are not displayed affect rendering performance?

This is a general question about how Drupal renders content. Say I have a content type with 20 fields, including some entity references, text fields, integers, and so on. When I have a lot of fields ...
4
votes
1answer
66 views

Force a single value base field to be in a separate table?

I have a custom entity type (eg: myentitytype), and I would like to add a new base field to it via hook_entity_base_field_info(). As I understand it, single value fields (with a cardinality of 1) will ...
-1
votes
1answer
48 views

How to let the user fill in the “Recipient” field of the contact form?

I created a new type of contact form. It is called "Invitation". The problem is that the recipient field does not appear and it is not editable. I want the user to fill in the recipient's ...
0
votes
1answer
25 views

Target EntityBrowser in custom validation constraint

Having a custom validation constraint on an entity reference field using entity browser as form widget, I am trying to get the field light up in the form on validation violation. This is not working ...
2
votes
2answers
96 views

Can I create non-default EntityReferenceSelection?

I have the following EntityReferenceSelection plugin: /** * Provides an entity reference selection for my_entity. * * @EntityReferenceSelection( * id = "extra:my_entity", * label = &...
2
votes
1answer
51 views

Reverse entity reference lookup

I have a data structure where content type research has an entity reference field scientists. The content type scientists does not have any research reference entity field though. I can get all ...
-1
votes
0answers
24 views

Entity print theming [closed]

I am facing an issue with the Entity print module. I have a view which is supposed to print articles. I want 2 different layouts for the PDF and for that I have created 2 different displays in the ...
-1
votes
1answer
40 views

How do I display only products that do not exceed the end date?

I created in my product type, a "Date interval" field. I created a view that contains this field. With a start date and an end date. I want my view to show only products that are within the ...
0
votes
1answer
17 views

How can I send mail containing rendered entity from referenced field?

How do I code a function for sending mail containing a rendered entity that is referenced from a field? I have content type A that contains static information, and content type B that users create and ...
0
votes
1answer
32 views

hiding field -reference option limit

Helloo ! I am using the D7 reference option limit module. I have two fields "primary" and "secondary" and I managed to reduce the choices of secondary based on the value of primary ...
1
vote
2answers
43 views

How to make a case sensitive entity query?

My custom entity type comes with a string field for which I would prefer case sensitive queries. When I use $query = \Drupal::entityQuery('my_entity_type') ->condition('my_token_field', '...
1
vote
1answer
44 views

How to create a new entity with default values if not passed?

Hello everyone how are you? I created a new configEntity called Modal with 3 fields: Label Body Auto Open To create a new Modal I'm using this code: $modal = \Drupal::entityTypeManager()->...
0
votes
0answers
36 views

views_embed_view in computed field

I have Content type A with these fields: Category and Amount. I want to add another field (Tax Amount) to calculate an amount based on Category and Amount inputted by user and sum of amount field of ...
0
votes
1answer
57 views

Autocomplete field where title is replaced with NID

I'm using Drupal 7 and I have made autocomplete function to be called on a field. File my_module.module: <?php function my_module_menu() { $items = array(); $items['/...
0
votes
0answers
13 views

Views entity reference field filtering results based on permissions but not overridable

I have created an entity reference field on a node type and it references entities of the Profile type, my Profile bundle is called 'Staff profile'. I want to allow certain users to see staff profiles ...
0
votes
2answers
72 views

How can I programmatically add data to an address field?

I'm trying to import user data from a json file. So far I managed to import most of the information, but now I'm stuck on the address field (created with Address module for Drupal 8). In the json file ...
-2
votes
0answers
30 views

How can I programmatically add a taxonomy, link field and other fields to a custom block type module?

I am learning to write a Custom Block Type with the below code from this question: How can I programmatically create a block type? However, I need help adding a couple other field types: Field that ...
2
votes
1answer
38 views

How to enable a field programmatically

I've created a field programmatically : $field_storage = FieldStorageConfig::create( array('entity_type' => 'node', 'field_name' => 'field_desc', 'type' => 'string')); $field_storage->...
0
votes
0answers
9 views

Views entity reference depending on other field in contact form

I have almost the same problem than Peter, here: Entity reference view depending on other field I have a contact form with two fields: brand and model. Brand is a taxonomy field and Model en entity ...
0
votes
0answers
15 views

Image can't be removed from widget after validation using entity validation api

I have created new media type(movie image). In that media type, I have two fields image and boolean field, I have referenced the movie image in content type and set upload limit of images to 10 and ...
0
votes
1answer
25 views

Changing existing date time field

I am working on an already existing site that has content. There is a content type with field date and time. I need to remove the time component and just be Date only without deleting any content ...
0
votes
1answer
13 views

Custom block with a field value that can be used in other twig template

I am creating a custom block with fields: field_items_to_show (items to show) field_logos (images, multiple) The site editor must have the option to set the amount of items to show in a field. in ...
1
vote
1answer
26 views

How to use Vertical Tabs on ConfigEntity Form

how are you? I've created a ConfigEntity and there a Configuration Form with Fieldsets and Fields. Example: But now I want to change this form to Vertical Tabs, like that: Do you know how can I do ...
1
vote
1answer
52 views

Drupal way of storing data related to a node [closed]

I want to store some data that is related to a node and trying to figure out the best way of doing it. For example, I send emails related to a node and I want to save details such as: To Email ...
1
vote
0answers
22 views

Guidance on entity reference - tokens or token parsing tools suggestions?

I have 3 content types - Organization, Site and Station. Stations related to a Site. Sites related to an Organization. A user can update is 'location' to show where they are working that day. I use a ...
0
votes
0answers
33 views

How translate Config Entity? [duplicate]

Hello everyone how are you? I created a ConfigEntity with some fields: Title (textfield) Body (CKEditor) After that I insert the first item: Title = "Hello World" Body = "This is a ...
1
vote
0answers
21 views

Token to output the last value in a multi-value field?

I have a text field in an Entityform set to accept an unlimited number of values: I'm trying to build a Rule that sends an email with the text from the last submitted value from the field. The token ...
1
vote
1answer
21 views

Creating a fallback field to load conditionally

So if I have a node type of Article. I have two fields on it: field_image field_secondary If field_secondary is being used, I'd like for that to be shown over field_image. Can anyone help point me ...
2
votes
2answers
61 views

Changing 2 Elements on Ajax Callback

I have an element $form['elements']['manufacturer']. On change, I want to change $form['elements']['form_factor'] and $form['elements']['model']. Currently I have: $form['elements']['manufacturer']['#...
0
votes
0answers
23 views

Better ordering of content within Books

I'm working with a Drupal site that features a fair amount of content, in excess of 1000 pages. The content is grouped in to Books and from there a hierarchical parent & child structure is created,...
0
votes
0answers
38 views

Collections of custom (ECK) entities

[ Similar question: How to add custom entities to group types? (Drupal Answers). But I ask specifically about ECK entities, not other simpler custom entities ] I want to implement collections of ...
0
votes
1answer
81 views

Update existing 'paragraph' entity while changing the ID is not supported

I'm trying to update a paragraph with this code: $entityManager = \Drupal::entityTypeManager(); $paragraph = $entityManager->getStorage('paragraph')->load('1'); $paragraph->set('...
0
votes
1answer
62 views

How to make a display mode of the current user on the home page?

I have a site built with Drupal 8 and the Twig Tweak module. I want to make the current user's frontpage_tasks display mode on my home page. How to do this ? I can make a user's frontpage_tasks ...
0
votes
1answer
9 views

Combine multivalue field rows with copy of same multvalue field

Having a list of pdfs using pdfpreview for image-preview I want to add an additional formatted text-field to this ouput. That's why I've created a copy of this field with a different formatter (e.g. ...
0
votes
0answers
17 views

Complex Group Permissions for Users and Content

My application holds content about projects. Projects have a number of entity reference fields including ones giving them both a team and a region. Projects live inside of units (1-to-1 relationship)...
0
votes
0answers
21 views

Get the value of a checkbox field (Boolean field type) from an entity object

Am trying to get the value of a Boolean field from a node entity, but it returns null whether the field is checked or not checked $field_id = 'field_test_boolean'; /** @var Node $entity */ $entity = \...
1
vote
1answer
21 views

Get order of a content type's fields

When I manage fields in content type edition I can put them in order. How could I retrieve this information to use it in a custom module. In Database there is no any column which saves weight order ...
0
votes
1answer
49 views

Create Custom Select Webform Element

I asked this last time with 'Select Other', but I am still not understanding how to change custom element's type. In this scenario, I am attempting to build a Select type webform element. I am reusing ...
-2
votes
1answer
55 views

How to automatically flag entities once (without PHP error)?

I created a custom module to automatically flag new entities and update entities. It works :-) Here is the problem : If I update a neud it is flagged. Perfect that's what I want to do, but if I update ...
0
votes
2answers
61 views

How do you target a specific type of content?

I have the content type (node), article, page, recipe. The code below can be used to flag any type of content. How do you target a specific type of content ? For example I only want to flag the ...
0
votes
0answers
27 views

how easy it is to get the date when the order is completed?

I need to get the due date (payment) of the last order, but I got some kind of crooked code. I receive all user orders by request. $allOrders = \Drupal::entityTypeManager()->getStorage('...
-1
votes
1answer
57 views

Cannot flag nodes and comments automatically

I created a code to automatically flag nodes and comments. When I put only the code to flag the nodes, it works. But when I add the code to flag the comments it doesn't work anymore. Which code should ...
0
votes
0answers
27 views

Override fieldset.html.twig

I am having some trouble understanding the concept of overriding twig templates. I have turned on debugging mode and most of the time I see overriding suggested file names like this: <!-- FILE NAME ...

1
2 3 4 5
171