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
0
votes
0answers
22 views

Listing two different custom entity types in one view

We defined two entity types, questions and answers. They are related to each other but we will need a view listing all questions and answers in order of title or created date for example. When you ...
4
votes
2answers
918 views

Difference between a bundle and a content type

Can somebody explain to me the difference between a content type and a bundle? Is the latter just a bundle for the entity node?
0
votes
1answer
482 views

Show/hide fields bij adding content based on checkbox

Is there a way to hide a specific or specifics fields in Drupal when you create content until you checked a checkbox? Now it looks like this: I need something like this: But I need some checkboxes ...
2
votes
1answer
30 views

Is there a way to get the max size of a varchar textfield?

I have an entity with a textfield created using the core Fields feature that looks like this when I inspect the type of the field table in the database varchar(40). I want to be able to determine max ...
1
vote
2answers
297 views

Find and display most recent referencing entities

I have 2 different node types. The first one describes a factory and the second one describes a measurement of the water inside the factory. The measurement content type has an Entity Reference field ...
0
votes
1answer
358 views

How can I query and order nodes with multiple date field values within a specific range?

I'm trying to get nodes that have date fields (multiple instances in some cases) and display them sorted ascending by start time for a given date. For illustrative purposes, here are some events and ...
41
votes
13answers
27k views

How do I remove a configuration object from the active configuration?

I'm writing a custom module for Drupal 8. It defines a field storage configuration object, in a file called modules/mymod/config/install/field.storage.bloom_stem.bs_twitter_ac.yml. The problem is ...
3
votes
3answers
5k views

How do I delete custom entity instances?

I've create a custom entity content with Drupal console, drupal generate:entity:content Now I want delete (remove) it completely, how can I achieve it with drupal console or drush ? my drupal ...
0
votes
0answers
35 views

Updating custom entity field

I have a custom entity and wish to increase size of a varchar field. This gives helpful input: https://www.drupal.org/docs/8/api/update-api/updating-database-schema-andor-data-in-drupal-8 I added ...
0
votes
1answer
417 views

Entity reference of a menu link gives Restricted access instead of the real data

I am trying to create an entity reference of a "menu link", but instead of having the menu link name I got "- Restricted access -". It seems to be the same problem with wysiwyg profile. I'm using the ...
1
vote
2answers
2k views

Migrating link fields to Drupal 8

I am trying to migrate a link field field_url from a Drupal 7 site to my Drupal 8 one. The link field is compound, it has a title and a url value. In my process plugin I am selecting the right values (...
1
vote
3answers
300 views

Print multiple files field links, descriptions and file extensions in Twig

I have a content type with a field field_file_attachment that allows uploading multiple files with txt, pdf, gif and img extensions. I would like to get links, descriptions and extensions of all ...
1
vote
2answers
56 views

How can I leave Subject as blank when fill nothing in the subject field of a comment?

When we fill nothing in the subject field of comment, drupal will use the comment body as the value of subject. See the code in CommentForm::buildEntity // Validate the comment's subject. If not ...
0
votes
2answers
265 views

How to generate iframe from Drupal 7 view (custom blog) with security token?

I have a Drupal 7 site with a custom blog created with custom content types and a combination of views. I need to be able to export this blog as an iframe with a "long security token" to be used on a ...
2
votes
1answer
104 views

How to add an extra field in file upload widget?

I know that it is possible to enable a description field in the core file upload widget for Drupal 7. However, I want to add an extra description field like the one already present. For this I've ...
-2
votes
2answers
40 views

How to get all the entity details which are using specific media?

I have a image "sample.jpg" (In media library) and I used this image in multiple custom blocks of different block types. Now I need the information of all the custom blocks which are using "sample....
1
vote
1answer
34 views

Duplicating content blocks

Is there a way to clone or make copies of blocks? For example, we have some blocks that are quite bespoke. We need to make multiple copies of them so we can display certain content within them on ...
3
votes
3answers
3k views

Add an entity reference select to a form

I am writing a Drupal 8 module, and I have some code that adds an entity reference field to a form. $form['commitment']['goal'] = array( '#type' => 'entity_autocomplete', '#title' => '...
1
vote
0answers
75 views

After saving entity bundle, entity_get_info('node') missing 'token type' property

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node 'token type' is gone: $info = entity_get_info('node'); // isset($info['token type'])) == FALSE ...
0
votes
1answer
363 views

How to interpret kint output

I have installed devel kint module on my drupal 8. Everything is fine with the module. But my problem is how should I interpret the output of kint correctly. Especially when I want to render field ...
1
vote
1answer
33 views

Get unsaved node from route parameter

What I want: In hook_media_presave I want to set a field value according to the same field on the referring node. By the referring node, I mean the node where the media entity is created through an ...
1
vote
1answer
51 views

How to represent media as individual entities?

I need some architectural advice please. I'm building a Drupal 8 site for the first time and I need to represent audio and video media on the site. There are probably fields I can use but I'm ...
0
votes
1answer
169 views

Webform field options missing Entity Reference?

We're using Webform 3.27 in Drupal 7 (not my call, don't yell at me) and it looks like one of the field type options should be Entity Reference, but we don't have that option. Not sure what's going on ...
4
votes
2answers
447 views

Node Load performance

I have a small question. If I use Node::Load on the route of the same node for example: I go to site.com/node/125 and in preprocess I use Node::Load(125), would Drupal load that node all over again? ...
1
vote
1answer
67 views

Newly created fields are not being displayed

I have a content type "Article" with fields and data that was migrated from a Drupal 7 website. In the admin/structure/types/manage/article/fields I added a new text field called "Test" with default ...
1
vote
1answer
90 views

Entity reference default value to first value

I have an entity reference field using a view to dynamically create a list based on a contextual filter from a user ID in URL. Works perfectly. Question is, how can I default the value to the first ...
0
votes
3answers
365 views

How to change date field label?

In my content I have one date field label, it is showing all uppercase letters automatically. Example :I have given date field label as birthday(lower case) but it's automatically showing BIRTHDAY(...
0
votes
1answer
208 views

Is there a reference by url widget type for term reference field as we have it for node reference field?

Is there a module for term reference as we have "Node reference url widget" module for node reference field. So that I can auto-populates a term reference field with a value from the URL.
1
vote
1answer
69 views

create a custom field which is allowing multiple values using custom module

I created custom content type and one custom field(text) successfully. But my requirement is, my custom field should allow to add multiple values.
0
votes
1answer
472 views

How to check if a menu exists programatically in Drupal 8

I have a script where I instantiate and fill menus with menu items programmatically. Whats the best way to check if a menu already exists if I already know it's ID.
4
votes
2answers
3k views

How to get a list/array of all content entities?

I need a list of all content entities, to query them all and check if they have a specific field. Couldn't find this in the API doku.
1
vote
2answers
3k views

Entity Reference - show link on referenced node

I have a "Entity Reference" field in a custom content type. I want to show on any referenced node the link to the node. How can I do it?
0
votes
1answer
141 views

(Newbie question) Something goes wrong here with db_add_field

I'm trying to adapt that D6 module to D7. I'm on the "add afield" part of .install Here's my code : function node_statistics_install() { db_add_field('accesslog', 'nid', array( 'description' ...
1
vote
2answers
205 views

Create many to many Relationship with a specific fields in a Content type to taxonomy

I am currently encounter a problem, I have one content type (Type) and two taxonomy needed to be link up, in that content type, I need to apply a many to many relationship among a field (Name: Core) ...
2
votes
2answers
2k views

Set date field in D8

I'm developing a module where I have to set a user profile date_field. I tried several methods to implement this but not one worked for me. Here is my method (status today) private function ...
2
votes
0answers
26 views

Can't pass the checkout process [duplicate]

I'm having this error on my website EntityMalformedException: Missing bundle property on entity of type commerce_line_item. in entity_extract_ids() (line 7866 of /var/www/xxx/xxx/includes/common.inc). ...
2
votes
2answers
650 views

Set default image when file not found (404)

I have many images but when one of them is missing it displays an empty <img>. Is there a method or hook that can be used to display a default image instead this empty <img> tag?
2
votes
1answer
737 views

How can I add a custom attribute to a link field?

For analytics/tracking purposes, I would like to add a custom attribute to a link field. Is there a way to add an additional text field to the link, similar to the title attribute field?
0
votes
1answer
35 views

How to make an custom content entity can be refered like user in Drupal 8?

Follow project examples, I have created a content entity, but how can make it can be attached into another entity as a reference field like user in drupal 8?
1
vote
1answer
141 views

Put eform's label and textfield(input) separate

I'm working on creating a table with eForm in Drupal 8. Since label and textfield(input) stick together, can I insert label and textfield(input) into separate <td>?
0
votes
1answer
351 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);
0
votes
1answer
400 views

Remove order from Field Collection set in form

I am using the Field Collection and Field Collection Fieldset modules to group a set of elements in my form. But what i see in the form is an Order column for the fieldset items, which i would like to ...
2
votes
1answer
431 views

Accessing content for a specific node revision via a relationship in Views

A module I've written implements hooks defined by the Field API to provide a custom field for defining references to specific node revisions by storing vids. (The module borrows functionality from the ...
0
votes
1answer
457 views

Accessing Content: Path field within views_view_unformatted TWIG template

I have a view that has the fields: Content: ID, Content: Title and Content: Path. In my views-view-module.html.twig file I can access the fields via the following: {{ item['#row']._entity.id }} {{ ...
0
votes
1answer
142 views

Show specific url path in admin theme

I want to edit in admin theme some editing pages like "entityform/*/edit". How can I do that?
1
vote
1answer
142 views

Does entity_save() trigger the update event?

Not quite sure if calling entity_save() from code will trigger the update event or not. So, does it?
0
votes
2answers
177 views

CCK field. how to use dynamic names to call CCK fields? (like: $node->$cckname)

I have several cck image fields. Each field has a consecutive name, for example: field_photos_1, field_photos_2, field_photos_3, field_photos_4 ... until 20 So my question is: How to call the image ...
0
votes
0answers
407 views

Entity form calculator in Drupal

I was wondering, is there anything like webform calculator for entity forms?
1
vote
1answer
479 views

How can I create a custom form settings to my custom field formatter?

I need to add form settings to my custom display format, can you provide me with an example? To be clear I just want to add some fields to the format settings form.
0
votes
1answer
395 views

hook_field_formatter_view does not get called

I have a custom field, that hooks into profile2 and saves it's value in user data blob. Everything works fine, except the hook_field_formatter_view, that does not get called for a reason. As a result, ...