function node_type_example_install
Same name in other branches
- 3.x modules/node_type_example/node_type_example.install \node_type_example_install()
Implements hook_install().
We don't want users to be able to delete our locked_content_type content type. So therefore we have to tell Drupal that this is the case. This can't be done in the content type's configuration YAML file, so we have to do it in code, here.
Related topics
File
-
modules/
node_type_example/ node_type_example.install, line 18
Code
function node_type_example_install() {
// Do not allow the locked content type to be deleted.
$locked = Drupal::state()->get('node.type.locked');
$locked['locked_content_type'] = 'locked_content_type';
Drupal::state()->set('node.type.locked', $locked);
}