public function OfficialFacebookPixelSettingsForm::buildForm in Official Facebook Pixel 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/ OfficialFacebookPixelSettingsForm.php, line 54 - Contains \Drupal\official_facebook_pixel\Form \OfficialFacebookPixelSettingsForm.
Class
- OfficialFacebookPixelSettingsForm
- Class OfficialFacebookPixelSettingsForm.
Namespace
Drupal\official_facebook_pixel\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$options = OfficialFacebookPixelOptions::getInstance();
$form[OfficialFacebookPixelConfig::FORM_PIXEL_KEY] = [
'#type' => 'textfield',
'#title' => $this
->t(OfficialFacebookPixelConfig::FORM_PIXEL_TITLE),
'#description' => $this
->t(OfficialFacebookPixelConfig::FORM_PIXEL_DESCRIPTION),
'#default_value' => $options
->getPixelId(),
'#maxlength' => 64,
'#size' => 64,
];
$form[OfficialFacebookPixelConfig::FORM_PII_KEY] = [
'#type' => 'checkbox',
'#title' => $this
->t(OfficialFacebookPixelConfig::FORM_PII_TITLE),
'#description' => $this
->t(sprintf(OfficialFacebookPixelConfig::FORM_PII_DESCRIPTION, OfficialFacebookPixelConfig::FORM_PII_DESCRIPTION_LINK)),
'#default_value' => $options
->getUsePii(),
];
return parent::buildForm($form, $form_state);
}