Skip to main content
DrupalABC

Main navigation

  • Home
  • Search
  • Learn Drupal
  • Certifications
  • Drupal Code Finder
User account menu
  • Log in

Breadcrumb

  1. Home

How to make node URL alias mandatory in Drupal 8 and Drupal 9?

You can use the following code snippet to change the required attribute of the path field in the node form alter in this way:

This will keep the path tab open by default and mark the alias field as required.

Tags
Drupal8
Form
Pathauto
Disqus
DrupalABC

Footer

  • Buy me a coffee
  • Drupal.org profile
  • LinkedIn
Powered by Drupal

Drupal is a registered trademark of Dries Buytaert