Creating node programmatically - where to put the code?

Hi,

I know that this is probably a dumb question, but... where should I put the code to create a node programmatically?
I've found many snippets to create a node from code, for example: https://gist.github.com/facine/35bb291811c146b6fc9e

But where should I put that code? In a custom module?
In D7 I could create a PHP script, bootstrap Drupal and then just execute the script... what about D8?

Thanks!

Removing non-existent config entity name

Ever since migrating from Drupal 7 to Drupal 8, I have had a few error messages of this sort:

"A non-existent config entity name returned by FieldStorageConfigInterface::getBundles(): field name: taxonomyextra, bundle: ad"

How to call a REST API ?

Drupal 8 is able to make POST and GET requests with a REST API ?

React Habitat with Drupal

Does anyone come across with React Habitat with Drupal?

If yes, could you explain how to integrate?

Thanks,

Sachin 

What's the best way to Categorize users without ROLES

I have dozens of roles that have no purpose other than helping us categorize users. Roles have no permissions associated with them. We only use ROLES to filter users for views, sending emails, and in custom code. The problem is the number of roles is having an adverse effect on managing user permissions. The permission management page becomes overwhelming (and sometimes unresponsive when editing).

How to centralise data/prices which can then be used throughout the site.

Firstly this isn't an e-commerce site, this is just for keeping prices on the site for advertising purposes. The fact I mention prices is arbitrary, just think of any old data format, this could be text or just a number in a field.

We need a central place where all prices/data can be kept, there needs to be translation capability for each price as they differ from country to country, we then need to be able to use these prices throughout the site, and for them to all update, to propagate when the central data of the prices is changed.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x