1 node.module node_config_delete_validate(Config $active_config, $all_changes)

Implements hook_config_delete_validate().

File

core/modules/node/node.module, line 3754
The core module that allows content to be submitted to the site.

Code

function node_config_delete_validate(Config $active_config, $all_changes) {
  $config_name = $active_config->getName();

  // Check config name for node type.
  if (strpos($config_name, 'node.type.') === 0) {
    // Check if node has content.
    $node_type = explode('.', $config_name);
    if (node_type_has_content($node_type[2])) {
      throw new ConfigValidateException(t('The content type "@content_type" cannot be deleted with active content associated to it. Delete the content manually, then retry the import.', array('@content_type' => $node_type[2])));
    }
  }
}