You are here

public function LingotekSettingsCommunityForm::buildForm in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  2. 4.0.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  3. 3.0.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  4. 3.1.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  5. 3.2.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  6. 3.3.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  7. 3.4.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  8. 3.5.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  9. 3.6.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  10. 3.7.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()
  11. 3.8.x src/Form/LingotekSettingsCommunityForm.php \Drupal\lingotek\Form\LingotekSettingsCommunityForm::buildForm()

*

Overrides ConfigFormBase::buildForm

File

src/Form/LingotekSettingsCommunityForm.php, line 29
Contains \Drupal\lingotek\Form\LingotekSettingsCommunityForm.

Class

LingotekSettingsCommunityForm
Configure text display settings for this page.

Namespace

Drupal\lingotek\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $community_id = $this->lingotek
    ->get('default.community');
  $communities = $this->lingotek
    ->getCommunities();

  //dpm($this->lingotek->get());
  $form['lingotek_user_directions_1'] = array(
    '#markup' => '<p>' . t('Your account is associated with multiple Lingotek communities.') . '</p>
      <p>' . t('Select the community that you would like associate with this site:') . '</p>',
  );
  $community_options = array();
  foreach ($communities as $id => $name) {
    $community_options[$id] = $name . ' (' . $id . ')';
  }
  asort($community_options);
  $form['community'] = array(
    '#title' => t('Community'),
    '#type' => 'select',
    '#options' => $community_options,
    '#default_value' => $community_id,
    '#required' => TRUE,
  );
  $form['lingotek_communities'] = array(
    '#type' => 'hidden',
    '#value' => json_encode($communities),
  );

  // Provide new button to continue
  $form['actions']['submit']['#value'] = t('Next');
  return $form;
}