Browse Source

Change function name and slightly safer logic.

pull/360/head
Adam Vessey 11 years ago
parent
commit
c5680fd1e0
  1. 14
      includes/utilities.inc

14
includes/utilities.inc

@ -869,6 +869,8 @@ function islandora_deprecated($release, $solution = NULL) {
/**
* Transform recursively-merged array of strings to renderable arrays.
*
* Renderable arrays are passed-through as-is.
*
* Previously, functions/hooks like islandora_view_object would return an
* associative array with string values containing markup. These values were
* then imploded into one large piece of markup. Here, we transform this older
@ -880,16 +882,24 @@ function islandora_deprecated($release, $solution = NULL) {
* of strings, which we transform to renderable markup elements (by
* reference).
*/
function islandora_array_of_markup_to_renderable_array(&$markup_array) {
function islandora_as_renderable_array(&$markup_array) {
foreach ($markup_array as &$value) {
if (!is_array($value)) {
// Not a renderable array, just a string. Let's convert it to a
// renderable '#markup' element.
$value = array(
'#markup' => $value,
);
}
else {
elseif (!isset($value['#type']) && !isset($value['#markup'])) {
// A simple array--possibly the result of a recursive merge? Let's
// look at each, to possibly convert them to a renderable '#markup'
// elements.
foreach ($value as &$inner) {
if (!is_array($inner)) {
// If it is an array at this level, we can assume that it is a
// renderable array. If it is not an array, convert to a renderable
// '#markup' element.
$inner = array(
'#markup' => $inner,
);

Loading…
Cancel
Save