Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
I have to add to one of the content types the possibility that when NODE_TYPE_1 is saved, if field_1 (type number or string) has the value of something specific, when saving NODE_TYPE_1, NODE_TYPE_2 has to be added, created with the value of field_1 passed to one of the fields of NODE_TYPE_2.
Any idea what to use, a controller?, the hook_entity_insert? another hook?
I need to copy some entities from one D9-database to different D9-database.
Both databases are full d9-databases - almost identical - but some nodes and users are present in one, which I need to copy to the other.
In Drupal 7 it was fairly simple. With both databases present in settings.php - let's say they were 'default' and 'second_db' - I could then do something along these lines:
<?php
// Switch to second database
db_set_active('second_db');
I'm using a view to list products from db index. I want to implement a custom sorting (my goal is to sort by current taxonomy term page, products having a specific node field field_MY_FIELD_NAME = CURRENT_TID, showing up first)
First using hook_views_data_alter I override the sort of an indexed field that I have chosen as a sort criteria inside the view