You are here

function _node_privacy_byrole_walk_role_fields in node privacy byrole 6

Same name and namespace in other branches
  1. 5 node_privacy_byrole.module \_node_privacy_byrole_walk_role_fields()

Loop recursively through form submissions to find values of rids since we can't be sure if the field returns a string or a nested array like in a multiple select.

1 call to _node_privacy_byrole_walk_role_fields()
node_privacy_byrole_rolereference_action in ./node_privacy_byrole.module

File

./node_privacy_byrole.module, line 608
Set node access permissions by role.

Code

function _node_privacy_byrole_walk_role_fields($form) {
  if (!is_array($form)) {
    return array(
      $form,
    );
  }
  else {
    $rids = array();
    foreach (array_keys($form) as $getvar) {
      if (element_child($getvar) && is_array($form) && !is_null($form[$getvar])) {
        $returned = _node_privacy_byrole_walk_role_fields($form[$getvar]);
        $rids = array_merge($rids, $returned);
      }
      else {
        $rids[] = $getvar;
      }
    }
  }
  return $rids;
}