You are here

function lightbox2_iframe_settings_form in Lightbox2 8

Same name and namespace in other branches
  1. 5.2 lightbox2.module \lightbox2_iframe_settings_form()
  2. 6 lightbox2.admin.inc \lightbox2_iframe_settings_form()
  3. 7.2 lightbox2.admin.inc \lightbox2_iframe_settings_form()
  4. 7 lightbox2.admin.inc \lightbox2_iframe_settings_form()

Configuration form for controlling the iframe behaviour.

3 string references to 'lightbox2_iframe_settings_form'
Lightbox2IframeSettingsForm::getFormId in src/Lightbox2IframeSettingsForm.php
Lightbox2IframeSettingsForm::getFormId in src/Form/Lightbox2IframeSettingsForm.php
Returns a unique string identifying the form.
lightbox2_menu in ./lightbox2.module
Implementation of hook_menu().

File

./lightbox2.admin.inc, line 677
Administrative page callbacks for the lightbox2 module.

Code

function lightbox2_iframe_settings_form() {

  // Add the javascript which disables / enables form elements.
  // @FIXME
  // The Assets API has totally changed. CSS, JavaScript, and libraries are now
  // attached directly to render arrays using the #attached property.
  //
  //
  // @see https://www.drupal.org/node/2169605
  // @see https://www.drupal.org/node/2408597
  // drupal_add_js(drupal_get_path('module', 'lightbox2') . '/js/lightbox2.js', 'module');
  // Set up a hidden variable.
  $form['lightbox2_lite'] = array(
    '#type' => 'hidden',
    '#value' => \Drupal::config('lightbox2.settings')
      ->get('lightbox2_lite'),
  );

  // Add text box for iframe width.
  $form['lightbox2_default_frame_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Default width'),
    '#description' => t('The default width of the iframe in pixels.'),
    '#default_value' => \Drupal::config('lightbox2.settings')
      ->get('lightbox2_default_frame_width'),
    '#size' => 20,
  );

  // Add text box for iframe height.
  $form['lightbox2_default_frame_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Default height'),
    '#description' => t('The default height of the iframe in pixels.'),
    '#default_value' => \Drupal::config('lightbox2.settings')
      ->get('lightbox2_default_frame_height'),
    '#size' => 20,
  );

  // Add option for iframe border.
  $form['lightbox2_frame_border'] = array(
    '#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' => \Drupal::config('lightbox2.settings')
      ->get('lightbox2_frame_border'),
  );
  return system_settings_form($form);
}