When an entity bundle has a Metatag field added to it, the field is added as an item in the display settings page. This is a little confusing, site builders aren't sure what to do with it.
Unwanted field. Bad field, bad.

CommentFileSizeAuthor
#2 metatag-n2844699.png20.3 KBdamienmckenna

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Issue summary: View changes
StatusFileSize
new20.3 KB
shamsher_alam’s picture

Please try this one

<?php
/**
 * Open description field hide and unset.
 */
function hook_form_node_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  unset($form['field_meta_tags']['widget']['0']['open_graph']['#description']);
  unset($form['field_meta_tags']['widget']['0']['open_graph']['article_expiration_time']['#des cription']);
  unset($form['field_meta_tags']['widget']['0']['open_graph']['article_modified_time']['#description']);
  unset($form['field_meta_tags']['widget']['0']['open_graph']['article_published_time']['#description']);
  unset($form['field_meta_tags']['widget']['0']['open_graph']['og_updated_time']['#description']);
  $form['field_meta_tags']['widget']['0']['advanced']['#access'] = FALSE;
}
?>
shamsher_alam’s picture

Status: Active » Fixed
damienmckenna’s picture

Status: Fixed » Active

Thanks for providing the code snippet. I don't think it's a reliable solution, though.

Also, please don't mark issues "fixed" until something has actually been fixed.

vakulrai’s picture

Hi DamienMcKenna,

What could the possible solution for it . I think removing it not a option but disabling it by default looks much more reliable so that it can used for further use

Thank's.

shamsher_alam’s picture

For me also the better solution is to disable unused meta option.

damienmckenna’s picture

Status: Active » Closed (duplicate)
Parent issue: » #2579327: Removed Metatag field from "Manage display" form