In this Question how-to-get-the-form-id-in-drupal-8-with-hook-form-alter all she asked was while placing the hook in a .module file the dpm for fetching $form_id(obvious from the code) is not getting displayed .

so what shall she do to achieve this ?

I see the question being explained well and also with proper coding but suddenly I see enter image description here

I would like to know how much more does one need to be specific ??

giving details would be helpful ..


| |
  • 1
    The question is how to get the form ID using hook_form_alter() which gets it as parameter. The OP didn't say what exactly it should be added. We cannot explain that dpm() should be avoided in those cases, that the form ID is passed as parameter, that she probably forgot to add a use line, and something else. The question seems to require users to guess what she did wrong, since she didn't ask any explicit, not vague, questions. – kiamlaluno May 26 '16 at 19:08
  • In fact, the given answers all say try this, which seems to mean I don't know if this is exactly your problem; I am just guessing. She could have put the use \Drupal\Core\Form\FormStateInterface; at the beginning of that file, as it is done from Drupal core; we cannot know this, since she didn't see all the code, so we are just guessing what she means and what the problem could be. – kiamlaluno May 27 '16 at 5:17
  • 1
    Thankyou for showing me the coding standard :) Yes, i agree we should use the use \Drupal\Core\Form\FormStateInterface; Also I think both title and content explain itself what did she want to achieve .. YES if the title did contradict with the body then there might arise a confusion among readers but both the title and the content is itself self-explanatory what was her ultimate objective.@kiamlaluno – make-me-alive May 27 '16 at 6:02
  • Exactly: the title and the content are a contradiction. It doesn't seem so self-explanatory, though, if two users had to say try this. – kiamlaluno May 27 '16 at 6:49

You must log in to answer this question.

Browse other questions tagged .