You are here

function shib_auth_block in Shibboleth Authentication 5.3

Same name and namespace in other branches
  1. 5.2 shib_auth.module \shib_auth_block()
  2. 6.4 shib_auth.module \shib_auth_block()
  3. 6 shib_auth.module \shib_auth_block()
  4. 6.2 shib_auth.module \shib_auth_block()
  5. 6.3 shib_auth.module \shib_auth_block()

Generate the HTML text for the shib_auth login block

@returns block HTML

Parameters

op the operation from the URL:

delta offset:

File

./shib_auth.module, line 188
Provides user authentication with Shibboleth (both v1.3 and v2.0) as well as some authorisation features (automatic role assignment base on Shibboleth attributes).

Code

function shib_auth_block($op = 'list', $delta = 0, $edit = array()) {

  // listing of blocks, such as on the admin/block page
  switch ($op) {
    case "list":
      $blocks[0] = array(
        'info' => t('Shibboleth authentication'),
        'status' => TRUE,
        'visibility' => 1,
        'weight' => 0,
        'region' => 'left',
      );
      return $blocks;
    case 'configure':
      $form = array();
      switch ($delta) {
        case 0:
          $form['auth_link_text'] = array(
            '#type' => 'textfield',
            '#title' => t('Text of the auth link'),
            '#require' => TRUE,
            '#size' => 60,
            '#description' => t('Here you can replace the text of the authentication link.'),
            '#default_value' => variable_get('auth_link_text', t('Click here to login via Shibboleth!')),
          );
      }
      return $form;
    case 'save':
      switch ($delta) {
        case 0:
          variable_set('auth_link_text', $edit['auth_link_text']);
      }
      break;
    case "view":
    default:
      switch ($delta) {
        case 0:
          $block = array(
            'subject' => t('Shibboleth login'),
            'content' => generate_login_text(),
          );
          break;
      }
      return $block;
  }
}