From: Michael M Slusarz Date: Wed, 3 Mar 2010 22:19:57 +0000 (-0700) Subject: Add 'cssfiles' hook to add custom CSS files to a page X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2c85abba6e6b4677ffd5c43a0ddb62936f374f9d;p=horde.git Add 'cssfiles' hook to add custom CSS files to a page --- diff --git a/framework/Core/lib/Horde.php b/framework/Core/lib/Horde.php index 820252358..569fcd886 100644 --- a/framework/Core/lib/Horde.php +++ b/framework/Core/lib/Horde.php @@ -1640,7 +1640,8 @@ HTML; * @param array $options Additional options: *
      * 'additional' - (array) TODO
-     * 'sub' - (string) TODO
+     * 'sub' - (string) A subdirectory containing additional CSS files to
+     *         load as an overlay to the base CSS files.
      * 
*/ static public function includeStylesheetFiles($options = array()) @@ -1834,6 +1835,16 @@ HTML; } } + /* Add user-defined additional stylesheets. */ + try { + $css = array_merge($css, self::callHook('cssfiles', array($theme), 'horde')); + } catch (Horde_Exception_HookNotSet $e) {} + if ($curr_app != 'horde') { + try { + $css = array_merge($css, self::callHook('cssfiles', array($theme), $curr_app)); + } catch (Horde_Exception_HookNotSet $e) {} + } + $css_out = array(); foreach ($css as $f => $u) { if (file_exists($f)) { diff --git a/horde/config/hooks.php.dist b/horde/config/hooks.php.dist index 2a77ebe62..952feab1e 100644 --- a/horde/config/hooks.php.dist +++ b/horde/config/hooks.php.dist @@ -135,6 +135,23 @@ * [mixed] - The data to send to the browser (will be JSON encoded). * * + * CSS Hooks + * ========= + * + * cssfiles + * -------- + * This hook allows additional CSS stylesheets to be added to the page + * output. + * + * Parameters in: + * $theme (string): The current theme. + * + * The return value from this hook is as follows: + * [throw Horde_Ajax_Exception] - Fatal error. + * [array] - An array of CSS files to add. Keys are the filesystem location, + * values are the URI location. + * + * * TODO: groupldap, share_add, share_modify, share_remove * * $Id$ @@ -439,6 +456,14 @@ class Horde_Hooks // // Code to run if the app is switched to horde // } + // Add CSS files hook. See above for description of format. +// function cssfiles($theme) +// { +// return array( +// '/file/path/to/css' => 'uri/to/css' +// ); +// } + /** * Allow altering or validating data submitted by a user during a signup * request before any attempts are made to add them to the system. diff --git a/horde/docs/CHANGES b/horde/docs/CHANGES index 4ecbe06aa..4839318e6 100644 --- a/horde/docs/CHANGES +++ b/horde/docs/CHANGES @@ -2,6 +2,7 @@ v4.0-cvs -------- +[mms] Add 'cssfiles' hook to add custom CSS files to a page. [jan] Add option to not automatically show all available shares. [jan] Add option to disallow world permissions for user shares. [mms] Allow Mozilla DNS prefetching to be turned off when displaying untrusted diff --git a/imp/config/conf.xml b/imp/config/conf.xml index a0ca9e35c..d32932b22 100644 --- a/imp/config/conf.xml +++ b/imp/config/conf.xml @@ -250,9 +250,6 @@ - - ViewPort Settings