Kim Stevens
Kim Stevens

Reputation: 63

How to programmatically add new content type to installed Drupal 8 module

I have a custom module which is already installed in production. Now I want to add a new custom type to the module without re-installing (don't want to lose existing production content). My understanding is that the config/install/node.type.*.yml files are only loaded on install of the module. I am running Drupal 8.3.5.

Can I do something in a method that would be run with update.php?

I already know how to add a field to an existing content type. That is not my question. This is a change that needs to go through our formal deployment process and is repeatable for future developers.

I am only looking to save a simple key-value pair. I am being told that I can't use the State or Key/Value library because we need the revision history that comes with actual content types.

Upvotes: 0

Views: 440

Answers (1)

Kim Stevens
Kim Stevens

Reputation: 63

This is what I was looking for: https://gist.github.com/yusufhm/875338b94baa2f81c05bde034c49abb3

Upvotes: 0

Related Questions