Paragraph module preprocess paragraph

Public

Example of preprocessing a paragraph

Get raw version
php
  1. //**
  2. * Implements hook_preprocess_entity().
  3. */
  4. function wwvs_slices_preprocess_entity(&$variables) {
  5. if ($variables['entity_type'] == 'paragraphs_item') {
  6. $edge = field_get_items('paragraphs_item', $variables['paragraphs_item'], 'field_edge');
  7. if ($edge && $edge[0]['value']) {
  8. $variables['classes_array'][] = 'slice--edge';
  9. }
  10. }
  11. }

Comments

Sumesh Mathew's picture

Is it possible to get other node fields in this function?
Say in my node i have paragraph fields and other fields as well. How to get that fields in the above function?