69 lines
1.6 KiB
Text
69 lines
1.6 KiB
Text
<?php
|
|
use OSInet\Splash\SettingsForm;
|
|
use OSInet\Splash\SplashBlock;
|
|
|
|
/**
|
|
* This module provides a splash screen and associated block.
|
|
*
|
|
* Settings:
|
|
* - An image file to display
|
|
* - An initial jQuery selector on which to display the splash: can be full
|
|
* screen or not
|
|
* - An optional later jQuery selector on which to display the image after it
|
|
* stopped being displayed on the element targeted by the initial selector
|
|
* - A list of pages on which to display the splash, as used by block.module
|
|
*/
|
|
|
|
function splash_menu() {
|
|
$ret = [];
|
|
|
|
$ret['admin/structure/block/splash'] = [
|
|
'title' => 'Splash',
|
|
'description' => 'Configure Splash block',
|
|
'page callback' => 'drupal_get_form',
|
|
'page arguments' => ['splash_settings_form'],
|
|
'access arguments' => ['administer blocks'],
|
|
'type' => MENU_LOCAL_ACTION,
|
|
];
|
|
|
|
return $ret;
|
|
}
|
|
|
|
function splash_block_info() {
|
|
$ret = [
|
|
SplashBlock::DELTA => SplashBlock::info(),
|
|
];
|
|
|
|
return $ret;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_block_view().
|
|
*/
|
|
function splash_block_view($delta = '') {
|
|
if ($delta != SplashBlock::DELTA) {
|
|
watchdog('splash', 'Incorrect block delta for display: @delta', ['@delta' => $delta], WATCHDOG_ERROR);
|
|
return;
|
|
}
|
|
|
|
return (new SplashBlock())->build();
|
|
}
|
|
|
|
/**
|
|
* Form builder for Splash settings.
|
|
*
|
|
* @param array $form
|
|
* @param array $form_state
|
|
*/
|
|
function splash_settings_form(array $form, array &$form_state) {
|
|
$form = new SettingsForm($form, $form_state);
|
|
$ret = $form->build();
|
|
return $ret;
|
|
}
|
|
|
|
/**
|
|
* Implements hook_xautoload().
|
|
*/
|
|
function splash_xautoload($api) {
|
|
$api->absolute()->addPsr4('OSInet\Splash\\', __DIR__ . '/lib/OSInet/Splash');
|
|
}
|