Questions tagged [drupal-entities]

"Entities" is the term that in Drupal 7 is used for nodes, comments, taxonomy terms, and users. Third-party modules can then define new entity types.

"Entities" is the term that in Drupal 7 is used for nodes, comments, taxonomy terms, and users. Third-party modules can then define new entity types.

One of the features of Drupal 7 entities is that they can have associated some fields created through the field UI, or implemented by third-party modules.

In Drupal 8, the API to handle entities has been extended, and entities are now object of specific classes implementing the interface; support for saving entities in the database has been added, where in Drupal 7 saving an entity was done by procedural functions.

Reference

See also

37 questions
8
votes
3 answers

How to update or create paragraph fields programatically in drupal8

Below is my solution with an example, that may help you. Update existing field $target_id = 62; $paragraph = Paragraph::load($target_id); $typeform_field = $paragraph->field_archtics_field->value; $archtics_field =…
Debraj nayak
  • 81
  • 1
  • 1
  • 2
2
votes
1 answer

Entity method loading twice

Lately I've been building a Drupal 7 module with the Entity API but I've run in to a problem. When debugging an edit form I've noticed that the load method is called twice which is causing an error. Recoverable fatal error: Object of class…
Bart
  • 433
  • 3
  • 19
2
votes
0 answers

Create database fields to an existing table when installing a module in Drupal 8

I'm new to drupal and I need some help. I created a new module with name user_extra. Which create necessery table when Installing the module. But I also need to insert some database field in 'users_field_data' table ('user_extra_id' and…
2
votes
1 answer

How do I get the node/entity from an instance of entity_metadata_wrapper in Drupal 7?

How do I get a reference to the node/entity used to instantiate entity_metadata_wrapper / EntityDrupalWrapper. I could not find a getNode/getEntity or similar method in the EntityDrupalWrapper API Reference. $wrapper =…
John Himmelman
  • 21,504
  • 22
  • 65
  • 80
2
votes
0 answers

Drupal Entity API and Views bulk operations - "Modify entity values" action provides empty form

I created new entity, some sample entities and views using VBO table. "Delete" VBO action works well, but "Modify entity values" provides an empty form with "Next" button and "Cancel" link only. If I submit this form Drupal shows me an error msg:…
Dmytro Sukhovoy
  • 952
  • 5
  • 17
2
votes
2 answers

Drupal 7 entityforms module: How to get value of a field with php?

I am using the entityform module to capture some user submitted data http://drupal.org/project/entityform I need to pull in some of the entity field values into one of my templates. I was trying to do this with some code that works for regular node…
Dustin
  • 4,314
  • 12
  • 53
  • 91
1
vote
1 answer

Drupal 9 - Allow access to a page only from a specific domain

How to allow access to a Drupal file/page only from a specific domain? I have tried php filter module but enabling this module can cause security and performance issues as it allows users to execute PHP code on your site.
1
vote
1 answer

Display a list of type group

I have read the tutorial, and the API, looked through the code examples. But when it came down to implementation, it didn't work as i thought it would. I am trying to avoid using the Views module for now, just for learning purposes. function…
user608672
  • 394
  • 5
  • 6
1
vote
1 answer

D8 PHP: Updating "Text (plain)" field value on node entity via set() and save() ignored when value changes from "1" to "01"

Goal: Programmatically change value of string field from "1" to "01" using entity ->set() and ->save() When attempting to update a field on a node programmatically (via a custom module's cron hook), the initial value of the "Text (plain)" field is…
1
vote
1 answer

Query Paragraph Type in Drupal 8

I am trying to Query all paragraphs of a certain type but I am not getting any output. Is my query right? Currently being returned an empty array. $query = $this->node->getQuery() ->condition('type', 'my_paragraph_type') …
J. E
  • 413
  • 1
  • 6
  • 12
1
vote
1 answer

Drupal 8 Image Field value

I'm trying to figure out how to get the path to an image from an entity in Drupal 8. I had thought get()->value would do it, but that just returns a blank string. I have a test function: function getValueTest ($profile_id, $field) { …
PhotoKevin
  • 97
  • 2
  • 9
1
vote
4 answers

Add a field from a node into page.tpl.php, drupal 7

Creating a sub-theme in Drupal 7's page.tpl.php and needing to pull the value (plain text) from field_EXAMPLE from a custom content type outside of where the rest of the content would normal be.
BVSK
  • 133
  • 2
  • 12
1
vote
0 answers

How to remove default fields a content entity

I was under the impression that by removing fields from public static function baseFieldDefinitions that they would not be required anymore during trying to save the entity. My function now only contains the following: $fields['id'] =…
Mokugo
  • 41
  • 9
1
vote
1 answer

Drupal 7: How to get this value with PHP

Please see the attached image below. I need to get the highlighted value via PHP and put it into one of my templates. I'm not exactly sure how this works, but this text is created as part of an entityform .
Dustin
  • 4,314
  • 12
  • 53
  • 91
1
vote
2 answers

Getting Entity Malformed Exception error while adding a taxonomy term in drupal7

I'm using Drupal7. When i'm adding a new term in a taxonomy vocabulary getting the following error. "Entity Malformed excetion : Missing bundle property on entity of type node.in entity_extract_ids()(line 7409 of…
Ranjani
  • 153
  • 1
  • 3
  • 12
1
2 3