function ctools_user_login_pane_render

1 string reference to 'ctools_user_login_pane_render'
user_ctools_block_info in plugins/content_types/block/block.inc

File

plugins/content_types/block/block.inc, line 440

Code

function ctools_user_login_pane_render($subtype, $conf, $panel_args, $contexts) {
    list($module, $delta) = _ctools_block_get_module_delta($subtype, $conf);
    // The login form is only visible to anonymous users.
    global $user;
    if ($user->uid) {
        return;
    }
    $info = new stdClass();
    $info->module = $module;
    $info->delta = $delta;
    $block = array();
    $block['subject'] = t('User login');
    // Manually set the content (rather than invoking block_view) because the
    // block implementation won't render on certain URLs.
    $block['content'] = drupal_get_form('user_login_block');
    // Allow modules to modify the block before it is viewed, via either
    // hook_block_view_alter() or hook_block_view_MODULE_DELTA_alter().
    drupal_alter(array(
        'block_view',
        "block_view_{$module}_{$delta}",
    ), $block, $info);
    $block = (object) $block;
    if (empty($block)) {
        return;
    }
    $block->module = $module;
    $block->delta = $delta;
    // $block->title is not set for the blocks returned by block_block() (the
    // Block module adds the title in block_list() instead), so we look it up
    // manually, unless the title is overridden and does not use the %title
    // placeholder.
    if ($module == 'block') {
        $block->title = $info->title;
    }
    elseif (isset($block->subject)) {
        $block->title = $block->subject;
    }
    else {
        $block->title = NULL;
    }
    if (isset($block->subject)) {
        $block->title = $block->subject;
    }
    else {
        $block->title = NULL;
    }
    if (user_access('administer blocks')) {
        $block->admin_links = array(
            array(
                'title' => t('Configure block'),
                'href' => "admin/structure/block/manage/{$module}/{$delta}/configure",
                'query' => drupal_get_destination(),
            ),
        );
    }
    return $block;
}