This project is not covered by Drupal’s security advisory policy.
Easy way to find variables in a complex variable structure.
Results are returned in a concise, readable list and to a PHP array. An easy way to find the variable you need. It's formatted in correct PHP format (including the -> class reference); simply paste the results into your template or module.
What It Is
- PVH assists developers/themers by searching through a complex variable array for a given value.
- It does the work for you; returning PHP formatted variable structures that are ready to paste into your template or module.
- For debugging, a variable array is returned so you can examine the results without restarting the session.
How To Use
- For this example, use page.tpl in any theme. I used an unmodified Marinelli theme.
- In page.tpl add this bit of code at the top: $varlist = pvh( $variables , 'block');
- Refresh your session and PVH will list every occurrence of 'block'. Here's what it will return:
PHP Variable Hunter results for needle = block
$variables['page']['content']['system_main']['#theme_wrappers']['0']; == block
$variables['page']['sidebar_first']['search_form']['search_block_form']['#parents']['0']; == search_block_form
$variables['page']['sidebar_first']['search_form']['search_block_form']['#array_parents']['0']; == search_block_form
$variables['page']['sidebar_first']['search_form']['search_block_form']['#id']; == edit-search-block-form--2
$variables['page']['sidebar_first']['search_form']['search_block_form']['#name']; == search_block_form
- Use the results by copy and pasting in your template or code.
- Developers can set a breakpoint on the line after PVH, inspect the results without restarting the session.
PVH is available also on GitHub: https://github.com/jeoware/PHP_Variable_Hunter/
Contributions Appreciated
If you appreciate PHP Variable Hunter, feel free to contribute to this effort at http://www.idxsoft.com/contribute
This module written by Jimmy Olsen of idxSoft LLC - http://www.idxsoft.com and supported by contributions.
Project information
- Project categories: Developer tools
- Created by jeoware on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
