You are here

function commons_site_homepage_block_view in Drupal Commons 7.3

Implements hook_block_view().

File

modules/commons/commons_site_homepage/commons_site_homepage.module, line 54

Code

function commons_site_homepage_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'commons_site_homepage':

      // The block does not have a default title.
      $block['subject'] = NULL;
      $links = array();

      // Display a 'sign up' link if visitors can create accounts.
      if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
        $links[] = array(
          'title' => t('Sign up'),
          'href' => 'user/register',
          'attributes' => array(
            'class' => array(
              'commons-sign-up',
            ),
          ),
        );
      }

      // Always display a 'log in' link.
      $links[] = array(
        'title' => t('Log in'),
        'href' => 'user/login',
        'attributes' => array(
          'class' => array(
            'commons-login',
          ),
        ),
      );
      $block['content'] = array(
        '#theme' => 'links',
        '#links' => $links,
        '#attributes' => array(
          'class' => array(
            'links',
            'inline',
          ),
        ),
      );
      break;
  }
  return $block;
}