public function Lightbox2IframeSettingsForm::buildForm in Lightbox2 8
Same name in this branch
- 8 src/Lightbox2IframeSettingsForm.php \Drupal\lightbox2\Lightbox2IframeSettingsForm::buildForm()
- 8 src/Form/Lightbox2IframeSettingsForm.php \Drupal\lightbox2\Form\Lightbox2IframeSettingsForm::buildForm()
File
- src/
Lightbox2IframeSettingsForm.php, line 38
Class
Namespace
Drupal\lightbox2Code
public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
// Add the javascript which disables / enables form elements.
drupal_add_js(drupal_get_path('module', 'lightbox2') . '/js/lightbox2.js', 'module');
// Set up a hidden variable.
$form['lightbox2_lite'] = [
'#type' => 'hidden',
'#value' => variable_get('lightbox2_lite', FALSE),
];
// Add text box for iframe width.
$form['lightbox2_default_frame_width'] = [
'#type' => 'textfield',
'#title' => t('Default width'),
'#description' => t('The default width of the iframe in pixels.'),
'#default_value' => variable_get('lightbox2_default_frame_width', 600),
'#size' => 20,
];
// Add text box for iframe height.
$form['lightbox2_default_frame_height'] = [
'#type' => 'textfield',
'#title' => t('Default height'),
'#description' => t('The default height of the iframe in pixels.'),
'#default_value' => variable_get('lightbox2_default_frame_height', 400),
'#size' => 20,
];
// Add option for iframe border.
$form['lightbox2_frame_border'] = [
'#type' => 'checkbox',
'#title' => t('Enable border'),
'#description' => t('Enable iframe border. You can modify the border style in your theme\'s css file using the iframe\'s id "lightboxFrame".'),
'#default_value' => variable_get('lightbox2_frame_border', 1),
];
return parent::buildForm($form, $form_state);
}