drupaldrupal-8

Customize node add page / Drupal 8


I need to customise the theme for the node add page in Drupal 8. I know how to customise the node page but not the add/edit pages.

EDIT (since this is closed and cannot be answered, but there is in fact a good answer)

Contrib solution (for Drupal 7 and modern Drupal) that makes it easy, providing a separate menu to power a replacement "Add content" page:

https://www.drupal.org/project/custom_add_content

(This can stay closed as there are open ones with the same question: https://drupal.stackexchange.com/questions/228050/reorder-content-types-in-node-add/316676 )


Solution

  • Is this the /node/add page or the /node/add/{type} page?

    The former uses the theme hook node_add_list (see https://git.drupalcode.org/project/drupal/blob/8.8.x/core/modules/node/src/Controller/NodeController.php)

    The latter page is just a form with the ID node_form, so it can be altered with hook_form_node_form_alter - see this question for how to alter a form to send it to a custom template: https://drupal.stackexchange.com/questions/146434/send-a-form-to-twig-template

    PS: I recommend https://drupal.stackexchange.com/ for Drupal-related questions.