You are here

function ajax_register_block_view in Ajax Login/Register 7.4

Implements hook_block_view().

File

./ajax_register.module, line 115

Code

function ajax_register_block_view() {

  // Show links only to anonymous users.
  if (user_is_anonymous()) {

    // Get enabled ajax links.
    $enabled_links = variable_get('ajax_register_enabled_links', array(
      'login',
      'register',
      'password',
    ));
    if (!$enabled_links) {

      // Hide block if user didn't choose at least one link.
      return FALSE;
    }

    // Include css and js for modal dialog.
    _ajax_register_include_modal();

    // Add a links to the block.
    $block['content'] = array(
      '#theme' => 'item_list',
      '#items' => _ajax_register_ajax_links($enabled_links),
      '#attributes' => array(
        'class' => array(
          'ajax-register-links',
        ),
      ),
    );

    // Display links inline.
    if (variable_get('ajax_register_show_links_inline', TRUE)) {
      $block['content']['#attributes']['class'][] = 'inline';
    }
    return $block;
  }
}