You are here

public function SimpleFBConnectAdmin::buildForm in Simple FB Connect 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/SimpleFBConnectAdmin.php, line 20

Class

SimpleFBConnectAdmin

Namespace

Drupal\simple_fb_connect\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  //        dpm(\Drupal::config('simple_fb_connect.settings')->get('simple_fb_connect_appid'));
  $form['simple_fb_connect_appid'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t('Application ID'),
    '#default_value' => $this
      ->config('simple_fb_connect.settings')
      ->get('simple_fb_connect_appid'),
    '#description' => t('Also called the <em>OAuth client_id</em> value on Facebook App settings pages. <a href="https://www.facebook.com/developers/createapp.php">Facebook Apps must first be created</a> before they can be added here.'),
  );
  $form['simple_fb_connect_skey'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t('Application Secret'),
    '#default_value' => $this
      ->config('simple_fb_connect.settings')
      ->get('simple_fb_connect_skey'),
    '#description' => t('Also called the <em>OAuth client_secret</em> value on Facebook App settings pages.'),
  );
  $form['simple_fb_connect_connect_url'] = array(
    '#type' => 'textfield',
    '#attributes' => array(
      'readonly' => 'readonly',
    ),
    '#title' => t('Connect url'),
    '#description' => t('Copy this value into Facebook Applications on Connect settings tab'),
    '#default_value' => $GLOBALS['base_url'],
  );
  $form['simple_fb_connect_login_only'] = array(
    '#type' => 'checkbox',
    '#title' => t('Login Only (No Registration)'),
    '#description' => t('Allow only existing users to login with FB. New users can not signup using FB Connect.'),
    '#default_value' => $this
      ->config('simple_fb_connect.settings')
      ->get('simple_fb_connect_login_only'),
  );
  $form['simple_fb_connect_user_pictures'] = array(
    '#type' => 'checkbox',
    '#title' => t('Fetch User Profile Pic on Registration'),
    '#description' => t('Gets the profile pic from facebook when user registers on the site with FB Connect.'),
    '#default_value' => $this
      ->config('simple_fb_connect.settings')
      ->get('simple_fb_connect_user_pictures'),
  );
  $form['simple_fb_connect_post_login_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Post Login url'),
    '#description' => t('Drupal URL to which the user should be redirected to after successful login.'),
    '#default_value' => $this
      ->config('simple_fb_connect.settings')
      ->get('simple_fb_connect_post_login_url'),
  );
  $form['simple_fb_connect_picture_dimensions'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t('Picture Dimensions'),
    '#default_value' => $this
      ->config('simple_fb_connect.settings')
      ->get('simple_fb_connect_picture_dimensions'),
    '#description' => t('The imported profile pic dimensions in widthxheight format. Ex: 200x100'),
  );
  return parent::buildForm($form, $form_state);
}