プログラムでカスタム コンテンツ (管理 UI を介して作成されたカスタム コンテンツ) を作成したい。しかし、作成する前に、カスタム コンテンツのフィールドの種類をプログラムで確認したい
カスタム コンテンツには、フィールド「body」(type text)、フィールド「description」(type text)、int フィールド (type int)、添付ファイル フィールド (type fid ?) が含まれています...
Drupal 8 の新しい API を使っていくつかの方法をテストします。これが最後の試みです。
// 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 \Drupal::getConta... Return an error : The "my_custom_content" entity type does not exist.
この $entity_object を使用して、カスタム コンテンツのフィールドのリストを取得するにはどうすればよいですか? EntityFieldManager クラス、FieldItemList クラスが表示されます...しかし、まだ drupal 8 / class / poo で遊ぶ方法がわかりません ... :/
ありがとう !