Linked Questions

0 votes
1 answer
695 views

How to use hook_node_insert to automatically flag nodes of a specific content type

All nodes of one content type in my project need to get automatically flagged (by the Flags module) when created. I'm aware that there is probably a way to accomplish this using Rules module, but I'm ...
aharown07's user avatar
  • 382
1 vote
0 answers
2k views

Programmatically add a node

Some years ago I made a Drupal 7 site. I want to remake the site with Drupal 9. In Drupal 7 I added nodes programmatically with this PHP code. define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT ...
Anna's user avatar
  • 11
-2 votes
1 answer
55 views

Is there a working example of programmatically creating a webform? [closed]

Is there a working example of programmatically creating a webform? I just need to see what works. The smallest excerpt will be helping out a lot. I can build on a foundation.
Mercuto27's user avatar
0 votes
2 answers
519 views

How to create new entity within a hook?

I am trying to create a hook that creates a new entity('Notification') when an entity of another type is created (either of type 'Deadline' or 'Message'), but I can't seem to figure out how to add a ...
sveggen's user avatar
  • 31
0 votes
3 answers
440 views

Cloning nodes between multisite instances with separate databases

I'm working on a Drupal 8.6 multisite and my client wants to be able to duplicate content between many of these sites. The codebase of the websites is the same, but each of them uses a different ...
André Luiz's user avatar
-1 votes
1 answer
153 views

Wizard or Form to create 5 nodes of 3 content types [closed]

I'm building a genealogy site. One of the most important use cases is to create an individual. I want to use a single form to capture information that will be used to create up to five nodes after ...
Erik Britt-Webb's user avatar
0 votes
1 answer
727 views

How can I programmatically insert content via a script or import instead of through the UI?

I have a custom content type and I now need to create thousands of entries using that type. It would take a very, very long time to go through the interface and add these one by one. I'm hoping there ...
garek007's user avatar
  • 129
2 votes
1 answer
2k views

Programmatically update node via array

I'm trying to import some nodes into a new D8 installation. Therefore I wrote a module. Importing nodes is already working perfectly. As you can see in my code snippet, I'm using the $field_array ...
themca's user avatar
  • 265
1 vote
1 answer
2k views

Programmatically creating a new instance of a custom content entity that contains a field collection

I am trying to write a script that will create about a thousand instances of a custom content entity type I defined via a module from existing data that I have prepared. Right now I just need to ...
saramm1's user avatar
  • 727
3 votes
2 answers
2k views

Kernel Test: Programmatically create a vocabulary and add a field to it

I want to add a taxonomy term and add field to it. My current code looks this way: <?php namespace Drupal\Tests\permissions_by_term\Kernel; use Drupal\KernelTests\KernelTestBase; use Drupal\...
jepster's user avatar
  • 953
1 vote
1 answer
902 views

How to create custom ECK entity class (per bundle) [closed]

With ECK I created Entity type Vehicle, and added 2 bundles, Car and Truck Goal is to have a class Car so I can use Car::create() and similar entity functions, and also implement my own functions. ...
Trupal's user avatar
  • 513