You are here

public function AdminSettingsForm::buildForm in Sharerich 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/AdminSettingsForm.php, line 41
Contains \Drupal\sharerich\Form\AdminSettingsForm.

Class

AdminSettingsForm
Class AdminSettingsForm.

Namespace

Drupal\sharerich\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('sharerich.settings');
  $form['global'] = array(
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Global settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['global']['allowed_html'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Allowed HTML tags'),
    '#description' => $this
      ->t('A list of HTML tags that can be used'),
    '#default_value' => $config
      ->get('allowed_html'),
  );
  $form['social'] = array(
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Social networks'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['social']['facebook_app_id'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Facebook App ID'),
    '#description' => $this
      ->t('You need to have an App ID, which you can get from Facebook.'),
    '#default_value' => $config
      ->get('facebook_app_id'),
  );
  $form['social']['facebook_site_url'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Facebook Site URL'),
    '#description' => $this
      ->t('You need to have an App ID, which you can get from Facebook.'),
    '#default_value' => $config
      ->get('facebook_site_url'),
  );
  $form['social']['youtube_username'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('YouTube Username'),
    '#description' => $this
      ->t('Enter your YouTube username in order for the social button to link to your YouTube channel.'),
    '#default_value' => $config
      ->get('youtube_username'),
  );
  $form['social']['github_username'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Github Username'),
    '#description' => $this
      ->t('Enter your Github username in order for the social button to link to your Github profile.'),
    '#default_value' => $config
      ->get('github_username'),
  );
  $form['social']['instagram_username'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Instagram Username'),
    '#description' => $this
      ->t('Enter your Instagram username in order for the social button to link to your Instagram profile.'),
    '#default_value' => $config
      ->get('instagram_username'),
  );
  $form['social']['twitter_user'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Twitter user'),
    '#description' => $this
      ->t('Used when sharing on twitter to identify the person sharing i.e. via @userid.'),
    '#default_value' => $config
      ->get('twitter_user'),
  );
  return parent::buildForm($form, $form_state);
}