🇮🇳India TOMY MOHAN
use Drupal\pathauto\PathautoState;
$contentTypes = [ 'library', 'news', 'events'];
foreach ($contentTypes as $contentType) {
$nodeQuery = \Drupal::entityQuery('node');
$nodeQuery->condition('type', $contentType);
$entity_ids = $nodeQuery->execute();
if (isset($entity_ids) && !empty($entity_ids)) {
foreach ($entity_ids AS $entity_id) {
$node = Node::load($entity_id);
$node->path->pathauto = PathautoState::CREATE;
$node->save();
}
}
}