public function GeofieldMapSettingsForm::buildForm in Geofield Map 8
Same name and namespace in other branches
- 8.2 src/Form/GeofieldMapSettingsForm.php \Drupal\geofield_map\Form\GeofieldMapSettingsForm::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
- src/
Form/ GeofieldMapSettingsForm.php, line 52
Class
- GeofieldMapSettingsForm
- Implements the GeofieldMapSettingsForm controller.
Namespace
Drupal\geofield_map\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->configFactory
->get('geofield_map.settings');
$form['#tree'] = TRUE;
$form['gmap_api_key'] = [
'#type' => 'textfield',
'#default_value' => $config
->get('gmap_api_key'),
'#title' => $this
->t('Gmap Api Key (@link)', [
'@link' => $this->link
->generate(t('Get a Key/Authentication for Google Maps Javascript Library'), Url::fromUri('https://developers.google.com/maps/documentation/javascript/get-api-key', [
'absolute' => TRUE,
'attributes' => [
'target' => 'blank',
],
])),
]),
'#description' => $this
->t('Geofield Map requires a valid Google API key for his main features based on Google & Google Maps APIs.'),
'#placeholder' => $this
->t('Input a valid Gmap API Key'),
];
return parent::buildForm($form, $form_state);
}