You are here

function fb_connect_block_configure in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 7.4 fb_connect.module \fb_connect_block_configure()

Implements hook_block_configure().

File

./fb_connect.module, line 205
Support for Facebook Connect features

Code

function fb_connect_block_configure($delta = '') {
  $orig_defaults = _fb_connect_block_login_defaults();
  $defaults = variable_get('fb_connect_block_' . $delta, $orig_defaults);
  $form['config'] = array(
    '#tree' => TRUE,
  );

  // Settings for each user status that we can detect.
  foreach (array(
    'anon_not_connected',
    'user_not_connected',
    'connected',
  ) as $key) {
    $form['config'][$key] = array(
      '#type' => 'fieldset',
      // title and description below
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $form['config'][$key]['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Default title'),
      '#default_value' => $defaults[$key]['title'],
    );
    $textformat = isset($defaults[$key]['body']['format']) ? $defaults[$key]['body']['format'] : 'full_html';
    $form['config'][$key]['body'] = array(
      '#type' => 'text_format',
      '#title' => t('Body'),
      '#base_type' => 'textarea',
      '#format' => $textformat,
      '#default_value' => $defaults[$key]['body']['value'],
    );
  }
  $form['config'][] = array(
    '#markup' => "<p><strong>Be sure to select a format that allows XFBML tags!</strong> (That is, use <em>Full HTML</em> or <em>PHP code</em> (PHP Filter module must be enabled), rather than  <em>Filtered HTML</em>.)</p>",
    '#weight' => -10,
  );
  $form['config']['anon_not_connected']['#title'] = t('Anonymous user, not connected');
  $form['config']['anon_not_connected']['#description'] = t('Settings when local user is Anonymous, and not connected to Facebook.  Typically a new account will be created when the user clicks the connect button.');
  $form['config']['anon_not_connected']['body']['#description'] = t('Suggestion: %default .', array(
    '%default' => $orig_defaults['anon_not_connected']['body']['value'],
  ));
  $form['config']['user_not_connected']['#title'] = t('Registered user, not connected');
  $form['config']['user_not_connected']['#description'] = t('Settings when local user is registered, and not connected to Facebook.  Typically the facebook id will be linked to the local id after the user clicks the connect button.');
  $form['config']['user_not_connected']['body']['#description'] = t('Suggestion: %default .', array(
    '%default' => $orig_defaults['user_not_connected']['body']['value'],
  ));
  $form['config']['connected']['#title'] = t('Connected user');
  $form['config']['connected']['#description'] = t('Settings when local user is connected to Facebook.  You may render facebook\'s logout button, and/or information about the user.  Consider using <a target="_blank" href="!xfbml_url">XFBML</a> such as &lt;fb:name uid=!fbu&gt;&lt;/fb:name&gt; or &lt;fb:profile-pic uid=!fbu&gt;&lt;/fb:profile-pic&gt;', array(
    '!xfbml_url' => 'http://wiki.developers.facebook.com/index.php/XFBML',
  ));
  $form['config']['connected']['body']['#description'] = t('Note that <strong>!fbu</strong> will be replaced with the user\'s facebook id.<br/>Suggestion: %default .', array(
    '%default' => $orig_defaults['connected']['body']['value'],
  ));
  return $form;
}