Using getThirdPartySetting() to get node type configurations in other hooks In a Drupal 8 instance, getThirdPartySetting() function to save node type configurations using the NodeTypeInterface object like below

  $type = $form_state-&gt;getFormObject()-&gt;getEntity();
  $fields = $type-&gt;getThirdPartySetting('field_config', 'type_fields', array(''));


Now I need to use the configurations in a hook for validation, to be particular in hook_entity_bundle_field_info_alter()

function hook_entity_bundle_field_info_alter(&amp;$fields
  , \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle)


It contains objects of EntityTypeInterface but not that of NodeTypeInterface. Now how can I access the configuration of the particular node type in the hook?

When I tried something like this in hook_entity_bundle_field_info_alter:

  $node_type = \Drupal\node\Entity\NodeType::load($bundle);
  $selected_fields = $node_type-&gt;getThirdPartySetting('field_config',
    'field_scope', '');


It throws an error as : Call to a member function getThirdPartySetting() on a non-object
$bundle is the node type (ID), so you can load the node type based on that.

$node_type = \Drupal\node\Entity\NodeType::load($bundle);