I want to programmatically create a custom content (custom content created via the admin UI). Before the creation, I want to check the types of fields of my custom content.
My custom content contains a field "body" (type text), a field "description" (type text), an int field (type int), an attached file field (type fid ?).
I tested several ways; this is my last try.
// I get the entity object "my_custom_content" $entity_object = NodeType::load("my_custom_content"); dpm($entity_object); //Work perfectly $test = \Drupal::getContainer()->get("entity_field.manager")->getFieldDefinitions("my_custom_content",$entity_object->bundle())
The code returns an error:
The my_custom_content entity type does not exist.
$entity_object, how can I get the list of the fields of my custom content?
I see the
EntityFieldManager class, the
FieldItemList class, but I still do not understand how to play with Drupal 8.