0

Need to change Drupal 8 node/add page titles - there have been some answers here (most for Drupal 7), but none of them have worked.

So there is always Create in front of the title in add page - need to drop the part Create - how ?

Need to drop also word Edit in from the already created node in edit mode - how ?

If someone can point me in right direction and give me _preprocess_node_add_list or some node preprocess sample.

Regards

Virgo

1

1 Answer 1

1

Try with hook_preprocess_page_title

function myModule_preprocess_page_title(&$variables) {
  //- Get the Current route name 
  $route_name = \Drupal::routeMatch()->getRouteName();
  switch ($route_name) {
    //- Add node Page
    case 'node.add' :
      $variables['title'] = t('New add page title');
      break;
    //- Edit node Page
    case 'entity.node.edit_form' :
      $variables['title'] = t('test');
      break;
  }
}
1
  • Thank u all, got my result - although its much easier than I expected (and learn some in between too) . I did it through D8 blocksystem without any programming. This was good for what I was aiming for. Commented Oct 25, 2018 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.