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
46
votes
7answers
39k views

How to change the length of field settings?

I have set once to a website a lenght limit to a field. And now the client wants to put more characters to that field. I cannot change the maximum size from Drupal because I get the following error ...
2
votes
2answers
548 views

Render fields url in tpl.php

I have a content type (music) with fields(image,track,title). I used a soundmanager player to display my track with its tpl.php(bar.tpl.php). I have tried to display url of the image field inside the ...
0
votes
1answer
404 views

How do I add fields and hide them from client?

I added fields to a Client profile using Profile2, such as first name and last name. But I added another fields, let's call it "Assigned Consultant". But the "Assigned Consultant" field... I don't ...
1
vote
1answer
51 views

Entity reference view depending on other field [closed]

I have a custom content type that contains an entity reference field (field_referencefield) and one more field as select box (field_triggerfield). The values of field_referencefield should depend on ...
1
vote
2answers
670 views

Entity form submission sending email

I'm working on entity form using the module "eform" in D8. I would like it to send email when the user submits a form. It was done using some other modules rules and entity rules, but since "entity ...
0
votes
2answers
670 views

Drupal 7 custom submit handler not getting triggered

I am having a problem connecting a custom submit handler to a form. I am trying to switch off redirecting after the save of an eck entity on edit form. But i am not getting that far as my submit ...
0
votes
1answer
419 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
1answer
449 views

How to change a collection field value with presave

I'm using field_collection module, and $question is a collection field. $question->value = 'test'; $node_poll->save(); The above code works for update this collection field value. Problem is ...
0
votes
1answer
393 views

How to interpret kint output [duplicate]

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 ...
0
votes
1answer
361 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
1answer
410 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 ...
4
votes
6answers
4k views

How to move “description” below the “label” for a field in a form?

Can I user form_alter to move move "description" below the "label" for a field in a form? Let´s say I want to move the "description" of the "body" field for the basic page content type.
1
vote
1answer
350 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
1answer
512 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
418 views

How to get “Add another item” option for fields based on taxonomy terms

The goal is to allow an autocomplete field that uses taxonomy terms, and which allows multiple entries from the same taxonomy list – for example a list of names & contact info for a field that ...
1
vote
2answers
443 views

Entity Reference and Views to allow a nested structure

I'm trying to implement a nested structure in such a way as to get a table (within a view?) similar to this: Parent Child Grandchild Age Sex John ...
0
votes
1answer
422 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. ...
2
votes
1answer
453 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
437 views

Calculate values from multiple content items

I have a Drupal 7 website that will be used to track automobiles in a fleet, as well as their engines and a few other items. Regarding the engines, I will be tracking the number of hours the engine is ...
1
vote
1answer
399 views

Setting up a date field to require an end date

I'm attempting to create a custom content type for a module via hook_install. When I create a date type (from Date module), I want it to require an end date (there's a checkbox when you're setting up ...
2
votes
1answer
395 views

How to populate a node reference field that has multiple values?

I'm using the rules to create a new node upon changing the current node publishing status to published. And populate some field based on the updated node field. Im trying to populate a node reference ...
0
votes
1answer
402 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, ...
0
votes
1answer
450 views

Using Entity metadata wrappers to change field value under hook_node_insert()

I am trying to change a field value inside both hook_node_insert() and hook_node_update() using EMW. It actually changes the original $node object that is passed to these hook functions but the change ...
0
votes
1answer
1k views

How to call preprocess functions from my custom module

I have created a custom module that declares a custom image formatter. Now I need to call the Core image module preprocess function 'template_preprocess_image_formatter'. How would I do that? I tried ...
1
vote
1answer
619 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 ...
4
votes
1answer
547 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(); $...
1
vote
2answers
528 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 ...
0
votes
3answers
498 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 ...
2
votes
1answer
475 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
342 views

403 Error on AJAX Request in add new item (collection field)

I have normal content type which has 12 collection fields each field has unlimited value when i try to click add new item on any field it gives me ajax error An AJAX HTTP error occurred. HTTP Result ...
0
votes
2answers
454 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
2answers
496 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 ...
4
votes
1answer
548 views

Per Bundle Storage for Drupal 8?

In Drupal 7 there was the start of Per-Bundle Storage (PBS) to try to store field data in a single database table if that made sense and was possible given the nature of the field. The PBS for Drupal ...
0
votes
1answer
476 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 ...
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 ...
4
votes
1answer
590 views

How to fix “Unable to save a field collection item without a valid reference to a host entity” error?

I programmatically created a series of custom content entities which contain field collections. My site had an execution timeout error in the middle of entity creation and saving. I can not delete ...
1
vote
1answer
482 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 ...
1
vote
1answer
436 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 ...
1
vote
1answer
47 views

Custom Entity is only showing via admin theme

I implemented a custom content entity with Drupal console. By default the routing is done in JobListingEntityHtmlRouteProvider.php file. I am getting a standard path such as /admin/structure/...
0
votes
2answers
416 views

hide field based on its value or value of another hidden field

I need to hide a radio button field of a content type (not a form) only on the edit view based either on its own value or based on the value of another field that is already hidden. Dependencies does ...
1
vote
2answers
457 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
2answers
464 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 $...
0
votes
2answers
376 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
0answers
17 views

Reference custom entity

I'am on Drupal7 and wanto to reference this custom entity function myentity_entity_info() { $info['myentity_basic'] = array( 'label' => t('Ind (myentity)'), 'controller class' => '...
2
votes
1answer
465 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
0answers
41 views

Custom entity query access handler

I'm trying to create a custom query access handler for one of our custom entities, and I must be missing something or have the wrong concept of how this is all supposed to work. Currently I have this ...
0
votes
2answers
154 views

How to change an address field that says “There is data for this field in the database. The field settings can no longer be changed.”?

How to change an address field that says "There is data for this field in the database. The field settings can no longer be changed."? I want to add a "Company" field as part of the address. I don't ...
0
votes
1answer
514 views

List field: translated values are not translated

In my Drupal 8 project I have some list fields. For example maybe a field "project type" with the following key|values, coming from the original language German: 1 -> öffentliches Projekt 2 -> ...
1
vote
1answer
484 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
455 views

Save selected values from a checkbox into a field

I've the next form. $query = "SELECT name, tid FROM taxonomy_term_data WHERE vid=2 AND language = '$language_url';"; $result = db_query($query); foreach ($result as $row2) { $options2[$...