public function YandexMapsSettings::buildForm in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_yandex/src/Form/YandexMapsSettings.php \Drupal\geolocation_yandex\Form\YandexMapsSettings::buildForm()
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
- modules/
geolocation_yandex/ src/ Form/ YandexMapsSettings.php, line 19
Class
- YandexMapsSettings
- Implements the Yandex Maps form controller.
Namespace
Drupal\geolocation_yandex\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->configFactory
->get('geolocation_yandex.settings');
$form['api_key'] = [
'#type' => 'textfield',
'#title' => $this
->t('Yandex Maps API Key'),
'#default_value' => $config
->get('api_key'),
'#description' => $this
->t('Yandex Maps requires users to sign up at <a href="https://developer.tech.yandex.ru/">developer.tech.yandex.ru</a>.'),
];
$form['packages'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Yandex Maps API Packages'),
'#options' => Yandex::getPackages(),
'#multiple' => TRUE,
'#default_value' => $config
->get('packages'),
'#description' => $this
->t('More about <a href="https://tech.yandex.ru/maps/archive/doc/jsapi/2.0/ref/reference/packages-docpage/">packages</a>.'),
];
return parent::buildForm($form, $form_state);
}