drupal_module__splash/lib/OSInet/Splash/SettingsForm.php

68 lines
1.8 KiB
PHP

<?php
/**
* @file
* SettingsForm.php
*
* @author: Frédéric G. MARAND <fgm@osinet.fr>
*
* @copyright (c) 2015 Ouest Systèmes Informatiques (OSInet).
*
* @license General Public License version 2 or later
*/
namespace OSInet\Splash;
class SettingsForm {
/**
* @var array
*/
public $form;
/**
* @var array
*/
public $state;
public function __construct(array $form, array &$form_state) {
$this->form = $form;
$this->state = $form_state;
}
public function build() {
$form = $this->form;
$form['splash-source'] = [
'#title' => t('Source selector'),
'#description' => t('The jQuery selector for the source container'),
'#type' => 'textfield',
'#default_value' => variable_get('splash-source', 'body'),
];
$form['splash-destination'] = [
'#title' => t('Destination selector'),
'#description' => t('The jQuery selector for the destination container. If empty, the splash will just disappear after the timeout.'),
'#type' => 'textfield',
'#default_value' => variable_get('splash-destination', ''),
];
$form['splash-timeout'] = [
'#title' => t('Timeout'),
'#description' => t('The number of milliseconds during which to display the splash.'),
'#type' => 'textfield',
'#size' => 5,
'#default_value' => variable_get('splash-timeout', 3),
];
$form['splash-body'] = [
'#title' => t('Splash content'),
'#description' => t('The content inserted as the splash. This is raw text, so be cautious. It will typically be something like &lt;img src="somepath.png" /&gt;'),
'#type' => 'textarea',
'#rows' => 5,
'#cols' => 80,
'#default_value' => variable_get('splash-body', ''),
];
$form = system_settings_form($form);
return $form;
}
}