You are here

dynamic_banner.module in Dynamic Banner 8

Distributed under GNU GPL version 3

Will create menus and the block needed to view all of the information Also will handle database writing and other cleanup functions

File

dynamic_banner.module
View source
<?php

use Drupal\Core\Routing\RouteMatchInterface;

// $Id$

/**
 * Distributed under GNU GPL version 3
 * @file
 * Will create menus and the block needed to view all of the information
 * Also will handle database writing and other cleanup functions
 */

// load the include file

//include_once('includes/callbacks.inc');

/**
 * Module Defaults
 */
define('BANNER_DEFAULT_OUTPUT', \Drupal::config('dynamic_banner.settings')
  ->get('dynamic_banner_display_setting'));
define('BANNER_DEFAULT_ERROR', \Drupal::config('dynamic_banner.settings')
  ->get('dynamic_banner_display_errors'));
define('BANNER_DEFAULT_BLOCK_NAME', \Drupal::config('dynamic_banner.settings')
  ->get('dynamic_banner_block_name'));
define('BANNER_DEFAULT_SAVE_LOCATION', \Drupal::config('dynamic_banner.settings')
  ->get('dynamic_banner_file_save_path'));
define('BANNER_DEFAULT_BANNER_MODE', \Drupal::config('dynamic_banner.settings')
  ->get('dynamic_banner_mode'));

/**
 * Implements hook_help().
 */
function dynamic_banner_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.dynamic_banner':
      $output = t('<p>Provides a mechanism for Pages to automatically generate a banner for use inside a block.</p>
        <h2>Settings</h2>
        <p>Move the block to the part of your theme you wish it to display on.
        I suggest adding in your own template theme for location and printining (see drupal theming)</p>
        <p>Change the theme file (located in dynamic banner module folder) so that you can change what the html is when dynamic banner prints.</p>
        <p>Change the css and js files to do what you like with the banner</p>
        <p>Modify the links inside of the admin/site_building menu or when you create new pages a specific banner appears on it, and / or make a default banner for non specific pages. </p>
        <p>Follow the convention of * for wild cards (no slash required) and ! for randoms (see examples)</p>
        <p>Example normal path = about/us</p>
        <p>Example random path = about/us!</p>
        <p>Example wildcard path = about/us*</p>
        <p>Please note that there is no leading slash or terminating slash (no slashing the begining or end)</p>
        <p>In the future you will be able to navigate to the image and select it and the url will be inserted for you</p>
        <p>Or when you choose to upload one on the spot the url will be grabbed from that.<p>
        <p>Example img path = sites/all/themes/banners/default.jpg</p>');
      return $output;
  }

  // end switch
}

// end help function

/**
 * Implements hook_theme().
 * theme template used in module.
 */
function dynamic_banner_theme() {
  $theme = array(
    'banner_output' => array(
      'variables' => [
        'bannerarr' => array(
          'url' => NULL,
          'text' => NULL,
          'link' => NULL,
          'display_setting' => NULL,
          'display_errors' => NULL,
        ),
      ],
      'path' => drupal_get_path('module', 'dynamic_banner') . '/templates',
      'template' => 'banner_output_template',
    ),
  );
  return $theme;
}

Functions

Namesort descending Description
dynamic_banner_help Implements hook_help().
dynamic_banner_theme Implements hook_theme(). theme template used in module.

Constants