0
これは私のコンテンツタイプの外観ですimage これをテーマにする最良の方法は何ですか?私は前にビューとビューフィールドコレクションを使用しました。 3つ目のフィールドコレクションの値、つまり画像ごとの収益情報を取得できませんでした。Drupalテーマのネストされたフィールドコレクション
このコンテンツタイプをテーマにするための最良の方法をご提案ください!
これは私のコンテンツタイプの外観ですimage これをテーマにする最良の方法は何ですか?私は前にビューとビューフィールドコレクションを使用しました。 3つ目のフィールドコレクションの値、つまり画像ごとの収益情報を取得できませんでした。Drupalテーマのネストされたフィールドコレクション
このコンテンツタイプをテーマにするための最良の方法をご提案ください!
テンプレートを使用することをお勧めします。あなたが望むようにスタイルを設定する方がずっと簡単です。具体的なケースの例を次に示します。
<?php
$field_nation = field_get_items('node', $node, 'field_nation');
foreach ($field_nation as $nation) {
$fc = field_collection_field_get_entity($nation);
// Nation name
$field_nation_name = field_get_items('field_collection_item', $fc, 'field_nation_name');
$field_nation_name = $field_nation_name ? $field_nation_name[0]['value'] : '';
// Another nested field collection
$field_companies_info = field_get_items('field_collection_item', $fc, 'field_companies_info');
foreach ($field_companies_info as $company) {
$fc2 = field_collection_field_get_entity($company);
// Company name inside second field collection
$field_company_name = field_get_items('field_collection_item', $fc2, 'field_company_name');
$field_company_name = $field_company_name ? $field_company_name[0]['value'] : '';
// Industry inside second field collection
$field_industry = field_get_items('field_collection_item', $fc2, 'field_industry');
$field_industry = $field_industry ? $field_industry[0]['value'] : '';
// Another nested field collection for Revenue information
$field_revounue_info = field_get_items('field_collection_item', $fc2, 'field_revounue_info');
// ..... And here another foreach similar to those above
}
}
?>