Stop! Wait a moment!
Do you want to change your life? Join me on my 50-Day Life Transformation Challenge. Get involved! It won't cost you anything except a few bad habits.
Stop! Wait a moment!
Do you want to change your life? Join me on my 50-Day Life Transformation Challenge. Get involved! It won't cost you anything except a few bad habits.
If you want to change the title of a form, whether it's the title of the registration form or a node add form, you have two options:
Here's an example of how to change the title of the registration form:
hook_preprocess_page_title
/**
* Implements hook_preprocess_HOOK().
*/
function MYTHEME_MYMODULE_preprocess_page_title(&$variables) {
if (\Drupal::routeMatch()->getRouteName() == 'registration_link.register') {
$variables['title'] = t('New Title');
}
}
hook_preprocess_html
/**
* Implements hook_preprocess_HOOK().
*/
function MYTHEME_MYMODULE_preprocess_html(&$variables) {
if (\Drupal::routeMatch()->getRouteName() == 'registration_link.register') {
$variables['head_title']['title'] = t('New Title');
}
}
These two approaches allow you to customize the title of a Drupal form of your choice. Replace 'New Title'
with the desired title text you want to display.
Comments