You are here

function _user_relationships_get_from_array in User Relationships 6

Same name and namespace in other branches
  1. 5.3 user_relationships_ui/user_relationships_ui.module \_user_relationships_get_from_array()
  2. 5 user_relationships.module \_user_relationships_get_from_array()
  3. 5.2 user_relationships.module \_user_relationships_get_from_array()
  4. 7 user_relationships.module \_user_relationships_get_from_array()

Recursively search an array for a key and return the value attached to it

1 call to _user_relationships_get_from_array()
user_relationships_ui_get_message in user_relationships_ui/user_relationships_ui.module
Public API for getting the set or default message

File

user_relationships_ui/user_relationships_ui.module, line 138
UI components of user_relationships @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217 @author Darren Ferguson (contributor) http://drupal.org/user/70179

Code

function _user_relationships_get_from_array($needle, &$haystack) {
  foreach ($haystack as $key => $value) {
    if ($key == $needle) {
      return $value;
    }
    elseif (is_array($value)) {
      if ($msg = _user_relationships_get_from_array($needle, $value)) {
        return $msg;
      }
    }
  }
}