Skip to content

Instantly share code, notes, and snippets.

View jdiglesias's full-sized avatar

Juan Iglesias jdiglesias

View GitHub Profile
@jdiglesias
jdiglesias / d8_render_arr_search.php
Created November 11, 2018 09:54
Find value within Drupal 8 render array
<?php
/**
* I got tired of clicking through render arrays displayed in Kint looking for a
* specific string. So I wrote this function to find all instances of that string
* and give me back a copy-pasteable index for each location.
*
* @param $str The string you're searching for
* @param $arr A Drupal 8 Render array
* @return array Strings representing PHP array indices that contain your string within $arr
*/