0

I'm searching for a hook in Drupal 8 API for adding values to a add content form. What hook can I use to alter values from /node/add/movies_movie page?

1

Inside your module, there is a [your-module].module file where you can write hook_form_alter().

/**
 * Implements hook_form_alter().
 */
 function module_name_form_alter(&$form, FormStateInterface $form_state, $form_id) {
   if ($form_id == 'node_movies_movie_form') {
     // Your code goes here.
     ...
     ...
   }
 }
  • And of course don't forget to clear cache after implementing hook_form_alter(). – Wim Mostrey Jan 9 '17 at 19:39
1

Think you are looking for the form alter hook here: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/8.2.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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