Last active
December 28, 2015 03:09
-
-
Save aklump/7432897 to your computer and use it in GitHub Desktop.
PHP: Convert a renderable Drupal array's properties to children.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert all element properties to children | |
* | |
* @param array $array An array with one or more keys that begine with '#' . | |
* | |
* @return array Any key that began with '#' will have the # stripped. | |
*/ | |
function element_properties_to_children($array) { | |
$keys = array_map(create_function('$item', 'return substr($item, 1);'), array_keys($array)); | |
return array_combine($keys, $array); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment