I am just wandering is there a way to hide some of the input fields in MetaData while creating/editing a node.

For example, I want to hide,

Geographical place name and Geographical position,

that is in MetaData->Advanced, in node form, so that user doesnt have access to it while creating a node.

Anything like hook form alter?

closed as too broad by kiamlaluno Aug 31 at 1:10

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Have you tried going to Form Display and seeing if you can hide the MetaData there? – Chris Happy Feb 7 '18 at 22:00
  • I think hes talking about a subset of tags within the metatag field, so that would not be possible. – Kevin Feb 8 '18 at 1:40
  • @ChrisHappy Yeah I am talking about the subset of tags – user24189 Feb 8 '18 at 14:03

I'll make the assumption you're using the Metatag module (https://www.drupal.org/project/metatag).

Unfortunately, this module doesn't allow fine-grain control of fields through its UI, so the only way I've found to hide these fields is through a form alter.

In this case, I'm modifying all node forms (use whatever hook fits your scenario here). Example, hiding the "advanced" fieldset entirely by disabling access to it, so it's not rendered:

function MY_MODULE_form_node_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
    $form['field_metadata']['widget']['0']['advanced']['#access'] = FALSE;

I'm sure this can be modified to target more specific nested groups/fields, but should give you a start at least!