You are here

function menu_node_access_parent_access_check in Panels Extras 7

Same name and namespace in other branches
  1. 6 menu_node_access/plugins/access/parent.inc \menu_node_access_parent_access_check()

Check for access.

1 string reference to 'menu_node_access_parent_access_check'
parent.inc in menu_node_access/plugins/access/parent.inc
Plugin to provide access control based upon if node being viewed belongs to a menu(s).

File

menu_node_access/plugins/access/parent.inc, line 65
Plugin to provide access control based upon if node being viewed belongs to a menu(s).

Code

function menu_node_access_parent_access_check($conf, $context) {

  // As far as I know there should always be a context at this point, but this
  // is safe.
  if (empty($context) || empty($context->data) || empty($context->data->menu_node_links)) {
    return FALSE;
  }
  foreach ($context->data->menu_node_links as $value) {
    if ($conf['menu_name'] == $value->menu_name) {
      $value = (array) $value;
      foreach ($value as $key => $plid) {
        if (in_array($key, array(
          'p1',
          'p2',
          'p3',
          'p4',
          'p5',
          'p6',
          'p7',
          'p8',
          'p9',
        ))) {
          if ($plid == $conf['parent']) {
            return TRUE;
          }
        }
      }
    }
  }
  return FALSE;
}