I want to loop through Paragraph bundles and return a string (image path uri string).
I can view the Paragraph arrays as such:
foreach ($variables['field_paragraphs'] as $i) { $entity = entity_load('paragraphs_item', array($i['value'])); dpm($entity); } This returns each Paragraph bundle as an multidimensional array. I want to take the value of each uri key and place them in their own array.
To that effect I have tried $image_path = $entity['ParagraphsItemEntity']['field_image']['und']['0']['uri'];, but it returns nothing.
I've also tried making a function.
function array_column_recursive(array $haystack, $needle) { $found = []; array_walk_recursive($haystack, function ($value, $key) use (&$found, $needle) { if ($key == $needle) { $found[] = $value; } }); return $found; } print(array_column_recursive($entity, 'uri')[0]); This gives me an error message.
Fatal error: Cannot redeclare array_column_recursive();
(It doesn't seem to matter what the function is named; it will always have this error.)
Would anyone know how to simply get a value from a multidimensional array in Drupal?