public function FacebookSettingsForm::buildForm in Media entity facebook 3.x
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/ FacebookSettingsForm.php, line 30
Class
- FacebookSettingsForm
- Provides a form to configure Facebook credentials.
Namespace
Drupal\media_entity_facebook\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$settings = $this
->config('media_entity_facebook.settings');
$form['credentials'] = [
'#type' => 'details',
'#title' => $this
->t('Facebook app credentials'),
'#description' => $this
->t("The Media Entity Facebook module requires a Facebook app ID and app secret. This information is required by Facebook when interacting with its API to retrieve the embed data. Create a Facebook app using a Facebook Developer account and enable that app to use the oEmbed API."),
'#open' => TRUE,
];
$form['credentials']['facebook_app_id'] = [
'#type' => 'textfield',
'#title' => $this
->t('App ID'),
'#size' => 40,
'#maxlength' => 255,
'#default_value' => $settings
->get('facebook_app_id'),
'#description' => $this
->t('The ID of your Facebook App.'),
];
$form['credentials']['facebook_app_secret'] = [
'#type' => 'textfield',
'#title' => $this
->t('App secret'),
'#size' => 40,
'#maxlength' => 255,
'#default_value' => $settings
->get('facebook_app_secret'),
'#description' => $this
->t('The secret of your Facebook App.'),
];
return parent::buildForm($form, $form_state);
}