You are here

function field_collection_theme_suggestions_field_collection_item in Field collection 8

Same name and namespace in other branches
  1. 8.3 field_collection.module \field_collection_theme_suggestions_field_collection_item()

Implements hook_theme_suggestions_HOOK().

File

./field_collection.module, line 173
Module implementing field collection field type.

Code

function field_collection_theme_suggestions_field_collection_item(array $variables) {
  $suggestions = [];
  $item = $variables['item']['#field_collection_item'];
  $sanitized_view_mode = strtr($variables['item']['#view_mode'], '.', '_');
  $suggestions[] = 'field_collection_item__' . $sanitized_view_mode;
  $suggestions[] = 'field_collection_item__' . $item
    ->bundle();
  $suggestions[] = 'field_collection_item__' . $item
    ->bundle() . '__' . $sanitized_view_mode;
  $suggestions[] = 'field_collection_item__' . $item
    ->id();
  $suggestions[] = 'field_collection_item__' . $item
    ->id() . '__' . $sanitized_view_mode;
  return $suggestions;
}