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
1answer
418 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 ...
1
vote
1answer
702 views

Inline entity form ajax

I am trying to update some field options in an inline entity form with ajax. This should happen, when someone selects a value in an other field. I already have some code which "works", but the ...
1
vote
1answer
525 views

Alter label with token

I am trying to build a questionnaire that simply replaces (alters) the label of a list-field. I´m doing so by replacing a token from views (embed) and using a hook_alter_form function in an separate ...
0
votes
1answer
461 views

custom field - How to get saved term selected for entity_autocomplete

I've looked all over, and for my level of understanding, I can't figure out how to get the stored value of an entity autocomplete field targeting taxonomy term type. I thought I could do something ...
0
votes
0answers
9 views

View with referenced nodes from field in the same paragraph possible?

I can not seem to figure out how to set up the correct contextual and relationship settings to accomplish the following: I have a node with a paragraph named slides. In the paragraph slides there is ...
0
votes
1answer
506 views

View displaying field collection items based on taxonomy term

I have a set of nodes that include a field collection item GeoImages. (Each node can contain multiple Geoimages, if that's relevant). Geoimages includes (among other fields) an Image and and Image ...
7
votes
2answers
7k views

How should I use hook_field_extra_fields()?

I just found out about hook_field_extra_fields(), but the documentation doesn't really tell me how to use it. Where is the extra-fields output generated? I tried hard to understand the Node and Poll ...
0
votes
1answer
13 views

How do I set up an entityreference entity base field to show as a link to the target entity?

I have a base field on my entity type that's an entity reference, e.g.: $fields['type'] = BaseFieldDefinition::create('entity_reference') How do I set this up so it displays as a link to the ...
0
votes
1answer
13 views

Add extra custom permissions to Field Permissions

I'm using Field Permissions module to restrict access to each field. If you choose custom permission on /admin/structure/types/manage/CONTENT_TYPE/fields/FIELD_NAME, you'll see these permissions are ...
1
vote
1answer
460 views

Use computed fields as Apache solr facets

Today I wanted to add a computed field to my facet to make a faceted search using that field but when checking the facets page that field wasn't in the allowed field to make facets. When i realized ...
3
votes
1answer
453 views

Altering ImageField Widget with FUpload enabled

I need to alter the ImageField Widget so that I can add some fields other than the Description, Alt and Title fields. I'm able to do this when I select the file field widget type as Image Uplaod, but ...
1
vote
2answers
546 views

Show initially 4 fields for Text field with unlimited value

I am building a website using Drupal 7. In my website there is a form for user to add some content. In the form there is a field of type "Text Field" (core). The "Number of values" for this text ...
3
votes
1answer
684 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 "...
5
votes
3answers
3k views

How to make EntityListBuilder sortable?

When defining custom content entities one can use EntityListBuilder to build a list of those entities for administrative purpose. By default such entities are ordered by ID, however it is possible to ...
0
votes
2answers
455 views

How can I programmatically populate a drop-down list field's options?

I have a paragraph bundle with several fields, on of them being drop-down list. How would I go about populating this dropdown list via code, programmaticaly? I don't really know where to begin with ...
0
votes
3answers
508 views

how to automatically create other entities when creating an entity

I have 4 entity types. All types have a relation to each other. For now let's call them A, B, C and D. How can I allow a user (let's say userA) to create an entity of type A so that entities for B, C ...
0
votes
1answer
28 views

Override remove entities link on module uninstall page

When a module needs to be uninstalled, Drupal adds links indicating there is content associated with the module which should be deleted first and provides a link Remove module_name entities. This ...
0
votes
0answers
20 views

Bug in setError when using unlimited cardinality with custom FieldType

I have recently added the field_example (Color RGB) custom field type to my Drupal instance (Drupal version is 8.9.1), didn't make any changes to the example code, and found that when using unlimited ...
1
vote
1answer
962 views

Profile field create and set default value programmatically

I need the checkbox to be checked by default. Below is my code, notice the 'default_value' under the settings array. $field_instance = array( 'field_name' ...
1
vote
1answer
512 views

How to get the highest value of a specific field in a multivalue field collection

How to get the highest value of a specific field in a multivalue field collection, USING PHP? This is about displaying the right discount for a marketplace product. There is a node type Product with ...
0
votes
1answer
546 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 }} {{ ...
1
vote
1answer
386 views

Why is an empty field on translated taxonomy term showing default language value?

I have a list of translated taxonomy terms (title, description, link, image). Only some of the translated terms have a value in the link field. Set up as Entity translation My view pulls all fields ...
0
votes
2answers
487 views

Define available default colors for Color Field programatically

I use the Color Field as a field in a custom module from where I create the content type programatically. By default the available colors are defined at this hook: color_field_field_settings_form in ...
0
votes
1answer
424 views

Assign textfield to each checked option in a checkboxes field

Lets say I have a checkboxes field and when I check one of the options, I would like a textfield to appear so I can assign a number (quantity) to it. Every option I check would have its own textfield. ...
1
vote
2answers
581 views

Set value for new field automatically based on another field

I want to add a new date field to an existing content type, and set the new field automatically for existing nodes to be equal to another date field from that content type. For example, if the new ...
2
votes
1answer
495 views

entity_metadata_wrapper langcode always prints default language

I'm using entity_metadata_wrapper with entity translation to print fields in a template, but it always prints the default language when using a langcode in the options. $wrap = ...
0
votes
2answers
476 views

Computed field that displays the full username of the author

I am using a computed field and I want to display the field_first_name and field_last_name, which are properties of the user that created that node. I have been trying things, but it seems like $...
3
votes
3answers
2k views

Set a datetime field configured as date-only

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. This is the code I am using. private function updateUser($...
1
vote
1answer
636 views

How do I attach an existing file to a node?

Here's my problem. I have a D6 site which has been in production for a number of years, and in consequence has used various methods (and modules) for displaying images within body text of book pages. ...
0
votes
2answers
530 views

Extract First Name and Last Name from the Title field in Drupal 7

In one of my content type, we are storing names in the Title field. Due to the recent requirement change we now need to sort results by last name. But since the name is stored in Title how can I ...
1
vote
2answers
460 views

How do I use print to generate a PDF of all entities referencing a specific node?

I'm trying to use the Print module to generate pdf's and epubs of the stories on my site. However, I need to get Print to generate these files from the story page and then generate the pdf with ALL ...
0
votes
0answers
10 views

Entity where member variable is different type than when serialized

Not entirely sure how to phrase this. I've got a config entity that needs to store a block id. In my config I have the mapping set to a string for the id. When I load the entity, I'd think it would be ...
0
votes
1answer
463 views

Theming paragraph fields from entity reference in view

I have a view (Drupal 8) where I load my entity reference field (display hidden), with three fields from a Paragraph type and a certain custom display). The HTML markup looks like this now: <div ...
1
vote
1answer
444 views

Pulling capacity and slots left from entity registration

I'd like to pull the values for capacity and the slots left from a registration created by the entity registration module. This sets up registration entities which are attached to (I believe this is ...
0
votes
1answer
29 views

Confused about Entity bundles

I'm trying to convert a Drupal 7 site to Drupal 9 before D7 reaches EOL, and I had a custom module that had a lot of custom tables defined in Hook Schema, that would be joined together in different ...
0
votes
2answers
387 views

How do I autopopulate fields in Drupal 8?

How do I autopopulate fields in a node form in drupal 8? Basically, what I'm trying to do is create an ajax callback to autopopulate fields based on a call to a 3rd party service. So I'm using ...
86
votes
7answers
16k views

When is it appropriate to create an Entity versus just adding a new content type?

What is the benefit to creating new entity types over just building a new content type? It seems a bit overkill to do all of the custom coding that is required to create a new entity when you have ...
-1
votes
1answer
46 views

The “dictionary_term” entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition()

I followed How to create a custom entity in Drupal 8 to create a module. When I installed it, I got the following error. Drupal\Component\Plugin\Exception\PluginNotFoundException: The "...
4
votes
1answer
592 views

EntityFieldQuery with Workflow

I need to filter an EntityFieldQuery with a given workflow state, let's say workflow it is state 21 (sid = 21). Below, the query I am using $query_formularios_completos = new EntityFieldQuery(); $...
0
votes
0answers
26 views

In which scenarios should i create a custom entity (content or config) rather than using content type? [duplicate]

I have always this question in mind, what are the perfect scenarios to create custom entity rather than using existing Drupal's entities ?
3
votes
1answer
1k views

Entity Browser in Forms API

I'm having trouble getting the entity browser widget to work correctly in a custom form. Just wondering if anyone has had any success in getting it working. I've got to the point the button is ...
1
vote
1answer
17 views

Non-Config Menus

I have this requirement where I would need to create a menu every time a user creates a new instance of a custom entity I'm building. One can easily do this with Menu::create() on entity creation, but ...
2
votes
1answer
502 views

default value when adding new item of date field

i'm using drupal 7 and in my content type there is a date field has start and end value with unlimited values, i set the default value to "Now". but the problem is when adding new item of this field ...
0
votes
1answer
502 views

Adding Quick Tabs Programmatically to a node is not working

I'm writing below code in my node--type.tpl.php, but only empty page is loading when i load the node page.Can you please help in knowing my mistake. What i need to add to display quicktab and its ...
1
vote
1answer
472 views

Referencing parent entity

I've just started with Drupal and I'm trying to create the following URL structure with PathAuto and Entity Reference: Category A -> Category B -> Category C Resulting in category_a/category_b/...
0
votes
0answers
34 views

How to create a term reference field programmatically

I need to add a taxonomy reference field to a node bundle, programmatically. I found a couple examples here, but one actually is incorrectly titled and is about creating a from field for it, and the ...
1
vote
1answer
528 views

Views math expression or Computed field to find date difference in views

I have two content type, Bill (Type1) and Cash Receipts (Type2), Type2 referencing Type1 when cash is received. In Type1 I have date field called (Bill Issue date), and Type2 I have date field cash ...
2
votes
1answer
447 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 ...
1
vote
2answers
474 views

How to sort view by a field that is part of a field collection?

I had searched solution for my problem, but I didn’t found anything good. I have custom a node type Client with Field Collection Product. My field collection has two fields: name of the product ...
1
vote
1answer
511 views

Date with an option for end date being either a date or “ongoing”

I have a content type that contains relevant information of a project. It should hold the projects start date and the end date OR the status "ongoing". How do I make this happen? With the date field ...

1
2 3 4 5
169