paragraphs.theme.inc 991 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * @file
  4. * Default theme functions for paragraphs.
  5. */
  6. /**
  7. * Process variables for paragraphs-items.tpl.php
  8. */
  9. function template_preprocess_paragraphs_items(&$variables, $hook) {
  10. $variables['view_mode'] = $variables['element']['#view_mode'];
  11. $variables['field_name'] = $variables['element']['#field_name'];
  12. $variables['content'] = $variables['element']['#children'];
  13. $variables['classes_array'][] = drupal_html_class('paragraphs-items-' . $variables['element']['#field_name']);
  14. $variables['classes_array'][] = drupal_html_class('paragraphs-items-' . $variables['element']['#field_name'] . '-' . $variables['view_mode']);
  15. $variables['classes_array'][] = drupal_html_class('paragraphs-items-' . $variables['view_mode']);
  16. $variables['theme_hook_suggestions'][] = 'paragraphs_items__' . $variables['element']['#field_name'];
  17. $variables['theme_hook_suggestions'][] = 'paragraphs_items__' . $variables['element']['#field_name'] . '__' . $variables['view_mode'];
  18. }