From e6e59359b9c6d3de38769a2097ad31e1f3d330f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Wed, 17 Oct 2007 15:24:56 +0000 Subject: #183332 by Eaton, JirkaRybka, catch and greggles: add Powered by Drupal block --- modules/system/system.module | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'modules/system/system.module') diff --git a/modules/system/system.module b/modules/system/system.module index 87e1ba65c..eb99f4e7e 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -52,6 +52,10 @@ function system_help($path, $arg) { return $output; case 'admin/build/modules/uninstall': return '

'. t('The uninstall process removes all data related to a module. To uninstall a module, you must first disable it. Not all modules support this feature.') .'

'; + case 'admin/build/block/configure': + if ($arg[4] == 'system' && $arg[5] == 0) { + return '

'. t('The Powered by Drupal block is an optional link to the home page of the Drupal project. While there is absolutely no requirement that sites feature this link, it may be used to show support for Drupal.') .'

'; + } case 'admin/settings/actions': case 'admin/settings/actions/manage': $output = '

'. t('Actions are individual tasks that the system can do, such as unpublishing a piece of content or banning a user. Modules, such as the trigger module, can fire these actions when certain system events happen; for example, when a new post is added or when a user logs in. Modules may also provide additional actions.') .'

'; @@ -105,6 +109,9 @@ function system_theme() { 'arguments' => array('menu_items' => NULL), 'file' => 'system.admin.inc', ), + 'system_powered_by' => array( + 'arguments' => array('image_path' => NULL), + ), )); } /** @@ -484,6 +491,46 @@ function system_user($type, $edit, &$user, $category = NULL) { } } +/** + * Generate a block with a promotional link to Drupal.org. + */ +function system_block($op = 'list', $delta = 0, $edit = NULL) { + switch($op) { + case 'list': + $blocks[0] = array( + 'info' => t('Powered by Drupal'), + 'weight' => '10', + 'status' => 1, + 'region' => 'footer', + ); + return $blocks; + case 'configure': + // Compile a list of fields to show + $form['wrapper']['color'] = array( + '#type' => 'select', + '#title' => t('Badge color'), + '#default_value' => variable_get('drupal_badge_color', 'powered-blue'), + '#options' => array('powered-black' => t('Black'), 'powered-blue' => t('Blue'), 'powered-gray' => t('Gray')), + ); + $form['wrapper']['size'] = array( + '#type' => 'select', + '#title' => t('Badge size'), + '#default_value' => variable_get('drupal_badge_size', '80x15'), + '#options' => array('80x15' => t('Small'), '88x31' => t('Medium'), '135x42' => t('Large')), + ); + return $form; + case 'save': + variable_set('drupal_badge_color', $edit['color']); + variable_set('drupal_badge_size', $edit['size']); + break; + case 'view': + $image_path = 'misc/'. variable_get('drupal_badge_color', 'powered-blue') .'-'. variable_get('drupal_badge_size', '80x15') .'.png'; + $block['subject'] = NULL; // Don't display a title + $block['content'] = theme('system_powered_by', $image_path); + return $block; + } +} + /** * Provide a single block on the administration overview page. */ @@ -1639,3 +1686,8 @@ function _system_zonelist() { } return $zones; } + +function theme_system_powered_by($image_path) { + $image = theme('image', $image_path, t('Powered by Drupal, an open source content management system'), t('Powered by Drupal, an open source content management system')); + return l($image, 'http://drupal.org', array('html' => TRUE, 'absolute' => TRUE, 'external' => TRUE)); +} -- cgit v1.2.3