To populate a field from the parent form to the inline entity form

I have two content types – Employee and Project.

Both forms have inline entity forms with references to the contents of each other

  • When a user creates an Employee node, he can add projects to which he has participated. When a user creates a Project node, he can add a list of the people who worked on this project.

However, I would like to pre-populate the title of the parent node in IEF. How can I do that?

For example, if I create a Project Content Type Project, I'll add some people. When saving the project node, these employees are mentioned on this project node. There is no link to this project in the employee node.

I would like to pre-populate the project title field in the IEF project of the employees when saving the project node and vice versa.
It sounds a bit like recursion and I'm not sure my explanation is clear, but I did my best.

Rules – The status of Drupal 7 entity registration is aborted after 30 minutes

On Drupal 7, I use entity registration and created a registration type with a timestamp field that retrieves the actual timestamp. After registering, the user has 30 minutes to review through the Commerce application.

I am trying to create a rule that can change the status from "completed" to "aborted". I use Drupal rules.
The event is: "After saving a new registry"
the condition is that the rule should fire after 30 minutes … I'll add the other one later with the Commerce solution. I do not know how to create the 30-minute condition here.
the action: I try to retrieve the entity by property. But I do not know how to change it.

Many Thanks

Design – To separate the responsibilities of a common entity

For example, suppose I have a performance class that stores performance information such as name, pop-up message, and so on.

Class GoldMedal implements GameAchievement {
@Run over
String getName () {...}

@Run over
String getAchievementDisplayMessage () {...}


When the game ends, I want to record the current achievements in local storage (Common settings) about static keys like ACHIEVEMENT_GOLD_MEDAL:

editor.putBoolean (ACHIEVEMENT_GOLD_MEDAL, isAchievedGoldMedal);

Question: Where should these keys be stored?

It's tempting to put it in it gold medal Since it is directly relevant and intuitive, does it feel like it violates SRP (or No?) Because it's related to the storage mechanism:

Class GoldMedal implements GameAchievement {
// ...

@Run over
String getStorageKey () {...}

// Usage:
editor.putBoolean (achievement.getStorageKey (), isAchieved (performance));

Another option that I thought about is to hide them under an interface:

Interface LocallyStorable {
String getStorageKey ();

Class GoldMedal implements GameAchievement, LocallyStorable {

@Run over
String getStorageKey () {...}

I think my question is generally the best course of action separate responsibilities that relate to a common entity, such as: Game Achievement?

For example, if there is a new property of a Game Achievement in another domain, for example in a tutorial page (String achievementTutorialText), should we make another interface from it?:

Interface GameTutorialComponent {
String getTutorialText ();

Many Thanks!

.net – Convert a string or int type to an entity or model type in c #.

I'm doing a POST with vue.js, and as soon as my JSON reaches the backend, I get the following error.

JSON Appendix:

Agency: "Agency N"
Surname Materno: "Lopez"
Surname Paterno: "Lopez"
Area: 13
DateIncome: "10/01/1989"
grupo_cc: "Vikings"
jefeDirecto: "Yo"
Name: "Alonso"
Number of employees: "893489"
Position: 8
turn: "1"

Error triggered by the browser in the console

My function that performs saving is as follows:

// POST: api / employee
        [HttpPost("[action]")]public async task Create ([FromBody] Employed employee)
if (! ModelState.IsValid)
return BadRequest (ModelState);

Employee e = new employee

Agency = staff. Agency,
NumberEmployee = employee.EmployeeNumber,
Name =,
LastNameMaterno = Employee. LastNameMaterno,
LastnamePaterno = Employee. Last name Paterno,
Enter Date = Employee.
Creation Date = DateTime.Today,
HeadDirect = employee.Direct boss,
Shift = employee. Rotate,
position =,
area = employee.area,

_context.Empleados.Add (employee);
try it
waitit _context.SaveChangesAsync ();
catch (exception ex)
return BadRequest ();

return Ok ();

Include the code of my employee model.

Enter the description of the picture here

I realize that I can not save a string or int in public Put put {get; set;}, because put is of the type Put.

I start with C #. I would be glad if you could give me a hint how to do this conversion.


8 – Show multiple entity reference field as draggable in node edit form?

You can get multiple values ​​in a table format with the draggable option if you want autocomplete Widget for this field below Manage form display for this content type (Not the Auto completion (tags style)).

If your field accepts an unlimited number of values, the widget is displayed as an autocomplete input field with a button Add another article, As you add more items, you can rearrange the order of the values ​​by dragging and dropping.

Entity Reference Autocomplete widget Unlimited values

You can also get this widget using the Inline Entities Form widget (with the Inline Entity Form plug-in).

Entities – How do I install the Entity Browser module?

I am trying to install the Entity Browser module, but the following error message appears:


In essence, it means that the entity type entity_browser does not exist. Based on the error, I tried to install the missing entity type using drush:

Error while executing drush entup

Once I ran drusn entup I was asked to install the missing entity, but Drush ended up with the same error message I get in the browser.

Could I miss something?

8 – How can I replace static file and media links in content with corresponding entity references?

I imported content from another system. For example, the body has a typical HTML like this:

Is there a way to retroactively replace all static join references with their Drupal 8 entity reference equivalents by looking up the unique filename? Or is there a way to achieve this on the first import / re-import?

I also have to do this for internal links.

Entity – Query blocks of a specific type with field value

I have a custom block on my website my_custom_block, This block has an entity reference field that points to a taxonomy Color box,

I'm trying to dynamically load some blocks of this type via AJAX, but I'm having problems.

$ entity_storage = $ this-> entityTypeManager () -> getStorage (& # 39; block & # 39;);
$ query_result = $ entity_storage-> getQuery ()
-> condition (& # 39; plugin & # 39 ;, & # 39; my_custom_block & # 39;)
-> condition (& # 39; field_color & # 39 ;, $ tid)
-> execute ();

This is the query I want to use.

  • If only I ask getStorage (& # 39; block & # 39;) I get many results. However, when I add conditions, I get no results. What am I doing wrong?
  • This is the right way to query a term in Color box?
  • Does a block have to be placed in a region or in "Disabled Blocks" to be queried? If not, how can I query all blocks, whether they have been placed or not?

Hooks – after 8.6.14 Set entity reference field via form change failed

After the kernel update, part of how the form-set change form was broken, I tried several methods, but it does not work that way:

$ form[‘field_trip_reference’][‘widget’][‘#default_value’] =
Field (820);
$ form[‘field_trip_reference’][‘widget’][0][‘target_id’][‘#default_value’]

= Drupal node Entity Node :: load (820); $ form[‘field_trip_reference’][‘widget’][0][‘target_id’][‘#value’] =
Drupal node Entity Node :: load (820);
$ form[‘field_trip_reference’][‘widget’][0][‘target_id’][‘#default_value’]

= 820; $ form[‘field_trip_reference’][‘widget’][0][‘target_id’][‘#value’] =
820; $ form[‘field_trip_reference’][‘widget’][0][‘target_id’] =
Drupal node Entity Node :: load (820);
$ form[‘field_trip_reference’][‘widget’][0][‘target_id’] = 820;
$ form[‘field_trip_reference’][‘widget’][‘target_id’][‘#default_value’]

= & # 39; node: 820 & # 39 ;;

something that needs to be updated?