Preprocess a twig template file I don't fully understand how preprocessing works

I have a twig template /themes/custom/client/templates/content/node--myfile.html.twig that I want to alter

I want to show/hide a part of that template depending on a field display with the machine name field_display stored in the matching content type called Project and with the machine name project_machine_name.

So I well understand I have to use hooks in order to do this, but I don't understand how I am supposed to name the hook functionnality neither how I'm supposed to access the data stored from the content type into the hook to alter the template view.

I know the hooks goes into the .module file. Actually I already have some of them, but I don't understand them properly. The only things I know for sure is that the function name must start by the module name

function my_module_SOMETHING_SOMETHINGELSE() {

}


So the issue is: how to name the hook function in order to alter the template ? I guess I understand the name is some kind of standard structure which will tell drupal if the function needs to be called before a specific action.

How to retrieve data stored from the display field of the content-types Project?

Thanks for your assistance.
Preprocess hooks are named MY_MODULE_preprocess_TEMPLATE_NAME, in your case:

function my_module_preprocess_node__myfile(&amp;$variables) {}


Notice how I replace the template's dashes with underscores in the function name.

Now you can get the display variable from $variables['node']-&gt;field_display-&gt;value.