I am rather new to Drupal and am trying to understand how the themes, templates, layouts, and fields work.
When editing the content type in the UI on the website for the book type, and "manage fields", the only field available is "body". When I go to the "form display", I see many more fields. When I go to "manage display", I am back to just the body and links mysteriously appears.
Compounding my confusion is the templates used for the module and how there is navigation export twigs but not all the same fields are used. In the templates directory of the book module, I found the twig files to copy to my theme folder and edit, but there seems to me to be missing information. For example, the book-node-export-html.html.twig only has the following code:
<article>
<h1>{{ title }}</h1>
{{ content }}
{{ children }}
</article>
Which is confusing because when I click the print button to export, I see the hidden fields like author and date information fields. I am guessing the content field is generated somehow which includes the authoring information, instead of splitting them out for theming.
In response to twig debugging comments:
I don't have enough experience with Drupal to understand how to phrase what I am asking. I have been "theming" for lack of a better term using the layout builder on content types.
you need to find the right template to customize
This is only part of the issue; I think before I get there, I need to understand why all the fields shown in the "form display" of the content type are not available in the other tabs or in the twig as show above. When I am debugging, the theme the fields I want to modify are not listed. For example, when I go to export the book and look at the html with twig debugging.
<!-- BEGIN OUTPUT from 'core/modules/node/templates/field--node--uid.html.twig' -->
<span>
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'username' -->
<!-- BEGIN OUTPUT from 'core/themes/olivero/templates/user/username.html.twig' -->
<a title="View user profile." href="/user/4">Name, A …</a>
<!-- END OUTPUT from 'core/themes/olivero/templates/user/username.html.twig' -->
</span>
<!-- END OUTPUT from 'core/modules/node/templates/field--node--uid.html.twig' -->
But you can clearly see that is not in the twig above, and I really just only want to modify it for this one display, and not everywhere on the website.
How do I manage this if the gui for the content type doesn't show these fields? See image below:
content
is not a field; it is a placeholder that is replaced by another template that contains the body field (and other custom fields that you may add via the UI). Twig templates are stacked-- the html template contains the page template, which contains the entity/book template, which contains the book/body template, and so on. So you need to find the right template to customize whatever you want, which you can do with twig debugging:drush twig:debug on