function devel_node_access_user_ajax

Page callback for node access by user block ajax.

3 string references to 'devel_node_access_user_ajax'
devel_node_access_block_view in ./devel_node_access.module
Implements hook_block_view().
devel_node_access_form_alter in ./devel_node_access.module
Implements hook_form_alter().
devel_node_access_menu in ./devel_node_access.module
Implements hook_menu().

File

./devel_node_access.module, line 1127

Code

function devel_node_access_user_ajax($data_type, $cell) {
    list($op, $nid, $uid) = explode('-', $cell);
    $account = user_load($uid);
    $output = array(
        '#theme' => 'dna_permission',
        '#permission' => _devel_node_access_explain_access($op, $nid, $account),
    );
    // JSON output for Ajax callbacks.
    if ($data_type == 'json') {
        drupal_json_output(drupal_render($output));
        exit;
    }
    // HTML output for error message click-throughs.
    if ($node = node_load($nid)) {
        $node_title = l($node->title, 'node/' . $node->nid);
    }
    else {
        $node_title = t('unknown node %nid', array(
            '%nid' => $nid,
        ));
    }
    drupal_set_title(t('Devel node access: %op permission for !user on !node', array(
        '%op' => $op,
        '!user' => theme('username', array(
            'account' => $account,
        )),
        '!node' => $node_title,
    )), PASS_THROUGH);
    return $output;
}